Subject: kernel: suppress sparse integer as NULL pointer warnings
Date: Thu, 03 Jul 2008 12:55:06 -0700
From: Harvey Harrison <harvey.harrison@gmail.com>

The trinary expression must handle both function pointers and
integers, reuse (expr) for both sides of the trinary to avoid
integer as NULL pointer warnings when (expr) is a pointer.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
 include/linux/compiler-gcc.h |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 9bf1cf1..87e52ae 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -76,7 +76,6 @@
  * function pointers as users expect, but means @expr must be a pointer or
  * integer.
  */
-#define cast_if_type(expr, oktype, desttype)				\
-  __builtin_choose_expr(__builtin_types_compatible_p(typeof(1?(expr):0),\
-						     oktype),		\
-			(desttype)(expr), (expr))
+#define cast_if_type(expr, oktype, desttype)	__builtin_choose_expr(	\
+	__builtin_types_compatible_p(typeof(1?(expr):(expr)), oktype),	\
+	(desttype)(expr), (expr))
