Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: lustre: libcfs: repair improper unlikely test

The scripts to replace NULL test got confused with the
macro parenthesis so the unlikely test in libcfs_private.h
ended up incorrect. This fixes this error.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

James Simmons and committed by
Greg Kroah-Hartman
a4424bf5 5bcf2a92

+2 -2
+2 -2
drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
··· 96 96 97 97 #define LIBCFS_ALLOC_POST(ptr, size) \ 98 98 do { \ 99 - if (!unlikely((ptr))) { \ 99 + if (unlikely(!(ptr))) { \ 100 100 CERROR("LNET: out of memory at %s:%d (tried to alloc '" \ 101 101 #ptr "' = %d)\n", __FILE__, __LINE__, (int)(size)); \ 102 102 } else { \ ··· 147 147 148 148 #define LIBCFS_FREE(ptr, size) \ 149 149 do { \ 150 - if (!unlikely((ptr))) { \ 150 + if (unlikely(!(ptr))) { \ 151 151 CERROR("LIBCFS: free NULL '" #ptr "' (%d bytes) at " \ 152 152 "%s:%d\n", (int)(size), __FILE__, __LINE__); \ 153 153 break; \