Re: [PATCH 2/5] dma-mapping: Add devm_ interface for dma_map_single()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On Fri, May 16, 2014 at 11:26:36AM +0300, Eli Billauer wrote:
> +dma_addr_t dmam_map_single(struct device *dev, void *ptr, size_t size,
> +			   enum dma_data_direction direction)
> +
> +{
> +	struct dma_devres *dr;
> +	dma_addr_t dma_handle;
> +
> +	dr = devres_alloc(dmam_map_single_release, sizeof(*dr), GFP_KERNEL);
> +	if (!dr)
> +		return 0;
> +
> +	dma_handle = dma_map_single(dev, ptr, size, direction);

Don't we wanna map the underlying operation - dma_map_single_attrs() -
instead?

> +	if (dma_mapping_error(dev, dma_handle)) {
> +		devres_free(dr);
> +		return 0;

Can't we just keep returning dma_handle?  Even if that means invoking
->mapping_error() twice?  It's yucky to have subtly different error
return especially because in most cases it won't fail.

Thanks.

-- 
tejun
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux