]> git.itanic.dy.fi Git - linux-stable/commitdiff
dma-direct: warn when coherent allocations aren't supported
authorChristoph Hellwig <hch@lst.de>
Fri, 6 Oct 2023 13:17:54 +0000 (15:17 +0200)
committerChristoph Hellwig <hch@lst.de>
Sun, 22 Oct 2023 14:38:54 +0000 (16:38 +0200)
Log a warning once when dma_alloc_coherent fails because the platform
does not support coherent allocations at all.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Greg Ungerer <gerg@linux-m68k.org>
Tested-by: Greg Ungerer <gerg@linux-m68k.org>
kernel/dma/direct.c

index 9657ef7c055eaa333efc7063d0fae57dda71927a..ed3056eb20b8bdb88f74e00727096f72f494847e 100644 (file)
@@ -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;
+               }
        }
 
        /*