aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-12-22 16:05:15 +0100
committerChristoph Hellwig <hch@lst.de>2018-01-15 09:34:55 +0100
commit57bf5a8963f80fb3828c46c3e3a5b2dd790e09a7 (patch)
tree17ccc31f02cbc09c8a51c8b95acf50f0b62e366b /include
parentdma-mapping: warn when there is no coherent_dma_mask (diff)
downloadlinux-dev-57bf5a8963f80fb3828c46c3e3a5b2dd790e09a7.tar.xz
linux-dev-57bf5a8963f80fb3828c46c3e3a5b2dd790e09a7.zip
dma-mapping: clear harmful GFP_* flags in common code
Lift the code from x86 so that we behave consistently. In the future we should probably warn if any of these is set. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Jesper Nilsson <jesper.nilsson@axis.com> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> [m68k]
Diffstat (limited to 'include')
-rw-r--r--include/linux/dma-mapping.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 16add66d5b68..d036e78b9ae9 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -518,6 +518,13 @@ static inline void *dma_alloc_attrs(struct device *dev, size_t size,
if (dma_alloc_from_dev_coherent(dev, size, dma_handle, &cpu_addr))
return cpu_addr;
+ /*
+ * Let the implementation decide on the zone to allocate from, and
+ * decide on the way of zeroing the memory given that the memory
+ * returned should always be zeroed.
+ */
+ flag &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM | __GFP_ZERO);
+
if (!arch_dma_alloc_attrs(&dev, &flag))
return NULL;
if (!ops->alloc)