Re: [PATCH v2 2/7] DMA-API: Introduce dma_(un)map_resource

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

 



On Mon, May 18, 2015 at 01:24:59PM -0500, wdavis@xxxxxxxxxx wrote:
> +static inline dma_addr_t dma_map_resource_attrs(struct device *dev,
> +						struct resource *res,
> +						size_t offset, size_t size,
> +						enum dma_data_direction dir,
> +						struct dma_attrs *attrs)
> +{
> +	const struct dma_map_ops *ops = get_dma_ops(dev);
> +	dma_addr_t addr = 0;
> +
> +	BUG_ON(!valid_dma_direction(dir));
> +	if (ops->map_resource)
> +		addr = ops->map_resource(dev, res, offset, size, dir,
		> atops->map_resourcetrs);
> +	debug_dma_map_resource(dev, res, offset, size, dir, addr);
> +
> +	return addr;
> +}

Please just do a BUG_ON(ops->map_resource == NULL) instead of checking the
pointer and returning 0 if it is NULL. The 0 could be a valid dma_addr
in some implementations, drivers are supposed to check the returned addr
with dma_mapping_error only (and no '== 0' checks).


	Joerg

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux