aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/dma-mapping.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-01-04 17:17:53 +0100
committerChristoph Hellwig <hch@lst.de>2019-02-01 09:56:38 +0100
commit645386dfe6307dbb28f10a4513792a59beda0efa (patch)
tree32166531d281cf857a6bb73a22b0cb4c0e0c12d1 /include/linux/dma-mapping.h
parentdma-mapping: remove the default map_resource implementation (diff)
downloadlinux-dev-645386dfe6307dbb28f10a4513792a59beda0efa.tar.xz
linux-dev-645386dfe6307dbb28f10a4513792a59beda0efa.zip
dma-mapping: don't BUG when calling dma_map_resource on RAM
Use WARN_ON_ONCE to print a stack trace and return a proper error code instead. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Robin Murphy <robin.murphy@arm.com> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Diffstat (limited to '')
-rw-r--r--include/linux/dma-mapping.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 9842085e6774..b904d55247ab 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -353,7 +353,8 @@ static inline dma_addr_t dma_map_resource(struct device *dev,
BUG_ON(!valid_dma_direction(dir));
/* Don't allow RAM to be mapped */
- BUG_ON(pfn_valid(PHYS_PFN(phys_addr)));
+ if (WARN_ON_ONCE(pfn_valid(PHYS_PFN(phys_addr))))
+ return DMA_MAPPING_ERROR;
if (dma_is_direct(ops))
addr = dma_direct_map_resource(dev, phys_addr, size, dir, attrs);