From: Christoph Hellwig Date: Fri, 6 Oct 2023 13:17:54 +0000 (+0200) Subject: dma-direct: warn when coherent allocations aren't supported X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=63f067e33c996a6e4d9a34d138116a43105182f1;p=linux.git dma-direct: warn when coherent allocations aren't supported Log a warning once when dma_alloc_coherent fails because the platform does not support coherent allocations at all. Signed-off-by: Christoph Hellwig Reviewed-by: Robin Murphy Reviewed-by: Greg Ungerer Tested-by: Greg Ungerer --- diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c index 9657ef7c055ea..ed3056eb20b8b 100644 --- a/kernel/dma/direct.c +++ b/kernel/dma/direct.c @@ -240,8 +240,10 @@ void *dma_direct_alloc(struct device *dev, size_t size, */ set_uncached = IS_ENABLED(CONFIG_ARCH_HAS_DMA_SET_UNCACHED); remap = IS_ENABLED(CONFIG_DMA_DIRECT_REMAP); - if (!set_uncached && !remap) + if (!set_uncached && !remap) { + pr_warn_once("coherent DMA allocations not supported on this platform.\n"); return NULL; + } } /*