Skip to content

Commit

Permalink
staging: lustre: libcfs: repair improper unlikely test
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
James Simmons authored and Greg Kroah-Hartman committed Nov 30, 2016
1 parent 5bcf2a9 commit a4424bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ do { \

#define LIBCFS_ALLOC_POST(ptr, size) \
do { \
if (!unlikely((ptr))) { \
if (unlikely(!(ptr))) { \
CERROR("LNET: out of memory at %s:%d (tried to alloc '" \
#ptr "' = %d)\n", __FILE__, __LINE__, (int)(size)); \
} else { \
Expand Down Expand Up @@ -147,7 +147,7 @@ do { \

#define LIBCFS_FREE(ptr, size) \
do { \
if (!unlikely((ptr))) { \
if (unlikely(!(ptr))) { \
CERROR("LIBCFS: free NULL '" #ptr "' (%d bytes) at " \
"%s:%d\n", (int)(size), __FILE__, __LINE__); \
break; \
Expand Down

0 comments on commit a4424bf

Please sign in to comment.