aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/gfp.h
diff options
context:
space:
mode:
authorDave Hansen <dave@linux.vnet.ibm.com>2011-05-24 20:11:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-25 11:39:11 -0400
commit15fa8f425557a0d698f933627771f520ef4ae34b (patch)
tree033020d146cef836681d56f570fb6b0116ac5794 /include/linux/gfp.h
parent72788c385604523422592249c19cba0187021e9b (diff)
include/linux/gfp.h: work around apparent sparse confusion
Running sparse on page_alloc.c today, it errors out: include/linux/gfp.h:254:17: error: bad constant expression include/linux/gfp.h:254:17: error: cannot size expression which is a line in gfp_zone(): BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1); That's really unfortunate, because it ends up hiding all of the other legitimate sparse messages like this: mm/page_alloc.c:5315:59: warning: incorrect type in argument 1 (different base types) mm/page_alloc.c:5315:59: expected unsigned long [unsigned] [usertype] size mm/page_alloc.c:5315:59: got restricted gfp_t [usertype] <noident> ... Having sparse be able to catch these very oopsable bugs is a lot more important than keeping a BUILD_BUG_ON(). Kill the BUILD_BUG_ON(). Compiles on x86_64 with and without CONFIG_DEBUG_VM=y. defconfig boots fine for me. Signed-off-by: Dave Hansen <dave@linux.vnet.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/gfp.h')
-rw-r--r--include/linux/gfp.h7
1 files changed, 1 insertions, 6 deletions
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 56d8fc87fbbc..7e8f5d863c76 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -249,14 +249,9 @@ static inline enum zone_type gfp_zone(gfp_t flags)
249 249
250 z = (GFP_ZONE_TABLE >> (bit * ZONES_SHIFT)) & 250 z = (GFP_ZONE_TABLE >> (bit * ZONES_SHIFT)) &
251 ((1 << ZONES_SHIFT) - 1); 251 ((1 << ZONES_SHIFT) - 1);
252
253 if (__builtin_constant_p(bit))
254 BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
255 else {
256#ifdef CONFIG_DEBUG_VM 252#ifdef CONFIG_DEBUG_VM
257 BUG_ON((GFP_ZONE_BAD >> bit) & 1); 253 BUG_ON((GFP_ZONE_BAD >> bit) & 1);
258#endif 254#endif
259 }
260 return z; 255 return z;
261} 256}
262 257