Re: [PATCH 19/33] dma-mapping: warn when there is no coherent_dma_mask

From
Konrad Rzeszutek Wilk <hidden>
Date
2018-01-12 13:16:57
Also in
linux-alpha, linux-arch, linux-arm-kernel, linux-iommu, linux-mips, linux-sh, lkml, sparclinux
Reply to
Christoph Hellwig, 2018-01-10
On Wed, Jan 10, 2018 at 09:00:13AM +0100, Christoph Hellwig wrote:
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: Konrad Rzeszutek Wilk <redacted>
quoted hunk ↗ jump to hunk
---
 include/linux/dma-mapping.h | 1 +
 1 file changed, 1 insertion(+)
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index d84951865be7..9f28b2fa329e 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->coherent_dma_mask);
 
 	if (dma_alloc_from_dev_coherent(dev, size, dma_handle, &cpu_addr))
 		return cpu_addr;
-- 
2.14.2
Thread (53 messages) 53 messages, 4 authors, last reply 2018-01-12
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help