From: Andrew Morton WARN_ON(pointer) generates "warning: initialization makes integer from pointer without a cast" Cc: Herbert Xu Cc: Ingo Molnar Signed-off-by: Andrew Morton --- include/asm-generic/bug.h | 17 +++++++++-------- include/asm-powerpc/bug.h | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff -puN include/asm-generic/bug.h~let-warn_on-warn_on_once-return-the-condition-fix include/asm-generic/bug.h --- a/include/asm-generic/bug.h~let-warn_on-warn_on_once-return-the-condition-fix +++ a/include/asm-generic/bug.h @@ -16,13 +16,14 @@ #endif #ifndef HAVE_ARCH_WARN_ON -#define WARN_ON(condition) unlikely({ \ - int __ret_warn_on = (condition); \ - if (unlikely(__ret_warn_on)) { \ - printk("BUG: warning at %s:%d/%s()\n", __FILE__, __LINE__, __FUNCTION__); \ - dump_stack(); \ - } \ - __ret_warn_on; \ +#define WARN_ON(condition) unlikely({ \ + typeof(condition) __ret_warn_on = (condition); \ + if (unlikely(__ret_warn_on)) { \ + printk("BUG: warning at %s:%d/%s()\n", __FILE__, \ + __LINE__, __FUNCTION__); \ + dump_stack(); \ + } \ + __ret_warn_on; \ }) #endif @@ -43,7 +44,7 @@ #define WARN_ON_ONCE(condition) \ unlikely({ \ static int __warn_once = 1; \ - int __ret_warn_once = (condition); \ + typeof(condition) __ret_warn_once = (condition);\ \ if (likely(__warn_once)) \ if (WARN_ON(__ret_warn_once)) \ diff -puN include/asm-powerpc/bug.h~let-warn_on-warn_on_once-return-the-condition-fix include/asm-powerpc/bug.h --- a/include/asm-powerpc/bug.h~let-warn_on-warn_on_once-return-the-condition-fix +++ a/include/asm-powerpc/bug.h @@ -71,7 +71,7 @@ struct bug_entry *find_bug(unsigned long } while (0) #define WARN_ON(x) unlikely({ \ - long __ret_warn_on = (x); \ + typeof(x) __ret_warn_on = (x); \ if (__builtin_constant_p(__ret_warn_on)) { \ if (__ret_warn_on) \ __WARN(); \ _