lkml.org 
[lkml]   [2019]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 3/3] dma-mapping: warn on harmful GFP_* flags
Date
The commit message of commit 57bf5a8963f8 ("dma-mapping: clear harmful
GFP_* flags in common code") says that probably warn when we encounter
harmful GFP_* flags which we clean -- because the client code is best
case silly if not buggy. I concur with that.

Let's warn once when we encounter silly GFP_* flags. The guys caring
about the respective client code will hopefully fix these soon.

Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
---

I'm not too happy with my warning message. Suggestions welcome!
---
include/linux/dma-mapping.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 5024bc863fa7..299f36ac8668 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -823,6 +823,9 @@ extern gfp_t dma_override_gfp_flags(struct device *dev, gfp_t flags);
static inline gfp_t dma_override_gfp_flags(struct device *dev, gfp_t flags)
{
/* let the implementation decide on the zone to allocate from: */
+ dev_WARN_ONCE(dev,
+ flags & (__GFP_DMA32 | __GFP_DMA | __GFP_HIGHMEM),
+ "fixme: don't dma_alloc with any of: __GFP_DMA32, __GFP_DMA, __GFP_HIGHMEM\n");
return flags & ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM);
}
#endif
--
2.17.1
\
 
 \ /
  Last update: 2019-09-23 14:36    [W:0.167 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site