Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1530158

Re: [PATCH 08/10] staging: lustre: libcfs: remove NULL comparisons in headers

From Dan Carpenter <dan.carpenter@oracle.com>
Newsgroups linux.kernel
Subject Re: [PATCH 08/10] staging: lustre: libcfs: remove NULL comparisons in headers
Date 2016-11-25 13:20 +0100
Message-ID <sHnDX-t4-11@gated-at.bofh.it> (permalink)
References <sEUwq-1by-49@gated-at.bofh.it> <sEUG5-1ff-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Nov 18, 2016 at 11:48:42AM -0500, James Simmons wrote:
> diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
> index 93bff1b..fc180b8 100644
> --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
> +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
> @@ -96,7 +96,7 @@
>  
>  #define LIBCFS_ALLOC_POST(ptr, size)					    \
>  do {									    \
> -	if (unlikely((ptr) == NULL)) {					    \
> +	if (!unlikely((ptr))) {						    \

Argh....  No.  You did this with a Perl script?

This should be:

	if (unlikely(!ptr)) { ...

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

Same.

Otherwise the unlikely hint is reversed from what we want.

regards,
dan carpenter

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/10] checkpatch fixes and style cleanups for libcfs headers James Simmons <jsimmons@infradead.org> - 2016-11-18 17:50 +0100
  [PATCH 08/10] staging: lustre: libcfs: remove NULL comparisons in headers James Simmons <jsimmons@infradead.org> - 2016-11-18 18:00 +0100
    Re: [PATCH 08/10] staging: lustre: libcfs: remove NULL comparisons  in headers Dan Carpenter <dan.carpenter@oracle.com> - 2016-11-25 13:20 +0100
  [PATCH 03/10] staging: lustre: libcfs: name parameters for function prototypes James Simmons <jsimmons@infradead.org> - 2016-11-18 18:00 +0100
  [PATCH 04/10] staging: lustre: libcfs: remove blank line in header James Simmons <jsimmons@infradead.org> - 2016-11-18 18:00 +0100
  [PATCH 01/10] staging: lustre: libcfs: fixup all header block comments James Simmons <jsimmons@infradead.org> - 2016-11-18 18:00 +0100
  [PATCH 02/10] staging: lustre: libcfs: remove header's bare unsigned use James Simmons <jsimmons@infradead.org> - 2016-11-18 18:00 +0100
  [PATCH 05/10] staging: lustre: libcfs: correct spelling in libcfs_cpu.h James Simmons <jsimmons@infradead.org> - 2016-11-18 18:00 +0100
  [PATCH 07/10] staging: lustre: libcfs: remove whitespace in libcfs_fail.h James Simmons <jsimmons@infradead.org> - 2016-11-18 18:00 +0100
  [PATCH 10/10] staging: lustre: libcfs: use uXX instead of __uXX types in headers James Simmons <jsimmons@infradead.org> - 2016-11-18 18:00 +0100
  [PATCH 09/10] staging: lustre: libcfs: remove zero comparisons in headers James Simmons <jsimmons@infradead.org> - 2016-11-18 18:00 +0100
    Re: [lustre-devel] [PATCH 09/10] staging: lustre: libcfs: remove  zero   comparisons in headers "Dilger, Andreas" <andreas.dilger@intel.com> - 2016-11-26 00:50 +0100
  [PATCH 06/10] staging: lustre: libcfs: use bit macro in libcfs headers James Simmons <jsimmons@infradead.org> - 2016-11-18 18:00 +0100

csiph-web