summaryrefslogtreecommitdiff
path: root/include/linux/dma-mapping.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-12-22 16:50:47 +0300
committerChristoph Hellwig <hch@lst.de>2018-01-15 11:34:43 +0300
commit205e1b7f51e4af2643eb1d61a6503e415cd1e014 (patch)
tree378eab5560b61a7f479d9c9a35aed2415956a8e3 /include/linux/dma-mapping.h
parent4b1b62b67d8b341ca97308822671b330a2c48c10 (diff)
downloadlinux-205e1b7f51e4af2643eb1d61a6503e415cd1e014.tar.xz
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 <hch@lst.de> Reviewed-by: Vladimir Murzin <vladimir.murzin@arm.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'include/linux/dma-mapping.h')
-rw-r--r--include/linux/dma-mapping.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index d84951865be7..16add66d5b68 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -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;