Hello,
On Thursday, December 01, 2011 6:30 AM Subash Patel wrote:
I know I am writing this too early ;) Sorry for bringing it up now.
In the function below: arm_iommu_free_attrs(), there is no return value even if we fail in arm_vmregion_find(). There can be buggy driver who can pass wrong buffer information (say, not using the VB2 layer like V4L2 based). Then there is no way to know if the memory is released or not.
The same is the case in coherent allocation, where dma_release_from_coherent() returns 1 for success, but we dont return any information to the caller at all.
Is it not fair to have a return value for free to notify if the memory was unmapped from the DMA/IOMMU map or not?
The whole DMA mapping framework assumes that all its functions are called with correct values/parameters. Please note that DMA mapping clients must pass the same arguments to the various DMA mapping functions. There is no 'dma object' concept which will simplify error handling. DMA mapping API doesn't define the return value for dma_free_coherent function. Although it would be useful to have such, I wanted to keep my patches as simple as possible and avoid cross-architecture changes as much as possible.
Best regards