kmemcheck: add missing braces to do-while in kmemcheck_annotate_bitfield
authorJohannes Berg <johannes@sipsolutions.net>
Mon, 6 Jul 2009 09:53:03 +0000 (11:53 +0200)
committerVegard Nossum <vegard.nossum@gmail.com>
Mon, 21 Sep 2009 21:34:24 +0000 (23:34 +0200)
Whether or not the sparse warning

warning: do-while statement is not a compound statement

is justified or not in this case, it is annoying and trivial to fix.

[vegard.nossum@gmail.com: title and cleanup]
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
include/linux/kmemcheck.h

index 47b39b7c7e849189a9115c7669181c8f4f4714bd..06c6c5501f13bdbb34602850d1071ca52772976c 100644 (file)
@@ -137,7 +137,10 @@ static inline void kmemcheck_mark_initialized_pages(struct page *p,
        int name##_end[0];
 
 #define kmemcheck_annotate_bitfield(ptr, name)                         \
        int name##_end[0];
 
 #define kmemcheck_annotate_bitfield(ptr, name)                         \
-       do if (ptr) {                                                   \
+       do {                                                            \
+               if (!ptr)                                               \
+                       break;                                          \
+                                                                       \
                int _n = (long) &((ptr)->name##_end)                    \
                        - (long) &((ptr)->name##_begin);                \
                BUILD_BUG_ON(_n < 0);                                   \
                int _n = (long) &((ptr)->name##_end)                    \
                        - (long) &((ptr)->name##_begin);                \
                BUILD_BUG_ON(_n < 0);                                   \