Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
dma-mapping: warn when there is no coherent_dma_mask
Browse files Browse the repository at this point in the history
These days all devices should have a DMA coherent mask, and most dma_ops
implementations rely on that fact.  But just to be sure add an assert to
ring the warning bell if that is not the case.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Vladimir Murzin <vladimir.murzin@arm.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
  • Loading branch information
Christoph Hellwig committed Jan 15, 2018
1 parent 4b1b62b commit 205e1b7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions include/linux/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ static inline void *dma_alloc_attrs(struct device *dev, size_t size,
void *cpu_addr;

BUG_ON(!ops);
WARN_ON_ONCE(dev && !dev->coherent_dma_mask);

if (dma_alloc_from_dev_coherent(dev, size, dma_handle, &cpu_addr))
return cpu_addr;
Expand Down

0 comments on commit 205e1b7

Please sign in to comment.