Fix sparse false positives re BUG_ON(ptr)
authorAlexey Dobriyan <[email protected]>
Tue, 17 Jul 2007 11:03:56 +0000 (04:03 -0700)
committerLinus Torvalds <[email protected]>
Tue, 17 Jul 2007 17:23:03 +0000 (10:23 -0700)
sparse now warns if one compares pointers with integers. However, there are
false positives, like:

fs/filesystems.c:72:2: warning: Using plain integer as NULL pointer

Every time BUG_ON(ptr) is used, ptr is checked against integer zero.  Avoid
that and save ~70 false positives from allyesconfig run.

mentioned by Al.

Signed-off-by: Alexey Dobriyan <[email protected]>
Acked-by: Al Viro <[email protected]>
Acked-by: Josh Triplett <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
include/asm-generic/bug.h

index 7f30cce528573ccbf4345021809dfd595d368d60..344e3091af24c09832e4a61d64841508b9f9f8a2 100644 (file)
@@ -28,7 +28,7 @@ struct bug_entry {
 #endif
 
 #ifndef HAVE_ARCH_BUG_ON
-#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
+#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while(0)
 #endif
 
 #ifndef HAVE_ARCH_WARN_ON