Skip to content

Commit 205e1b7

Browse files
author
Christoph Hellwig
committed
dma-mapping: warn when there is no coherent_dma_mask
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 <[email protected]> Reviewed-by: Vladimir Murzin <[email protected]> Reviewed-by: Konrad Rzeszutek Wilk <[email protected]>
1 parent 4b1b62b commit 205e1b7

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

include/linux/dma-mapping.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,7 @@ static inline void *dma_alloc_attrs(struct device *dev, size_t size,
513513
void *cpu_addr;
514514

515515
BUG_ON(!ops);
516+
WARN_ON_ONCE(dev && !dev->coherent_dma_mask);
516517

517518
if (dma_alloc_from_dev_coherent(dev, size, dma_handle, &cpu_addr))
518519
return cpu_addr;

0 commit comments

Comments
 (0)