LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] - [9/15] - remove defconfig ptr comparisons to 0 - fs/nfsd
@ 2007-11-14  2:05 Joe Perches
  2007-11-14  2:38 ` Neil Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Joe Perches @ 2007-11-14  2:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Linus Torvalds, J. Bruce Fields, Neil Brown, nfs

Remove defconfig ptr comparison to 0

Remove sparse warning: Using plain integer as NULL pointer

Signed-off-by: Joe Perches <joe@perches.com>

---

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index d019918..07b38cf 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -987,7 +987,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
 	 * flushing the data to disk is handled separately below.
 	 */
 
-	if (file->f_op->fsync == 0) {/* COMMIT3 cannot work */
+	if (!file->f_op->fsync) {/* COMMIT3 cannot work */
 	       stable = 2;
 	       *stablep = 2; /* FILE_SYNC */
 	}



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] - [9/15] - remove defconfig ptr comparisons to 0 - fs/nfsd
  2007-11-14  2:05 [PATCH] - [9/15] - remove defconfig ptr comparisons to 0 - fs/nfsd Joe Perches
@ 2007-11-14  2:38 ` Neil Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Neil Brown @ 2007-11-14  2:38 UTC (permalink / raw)
  To: Joe Perches; +Cc: linux-kernel, Linus Torvalds, J. Bruce Fields, nfs

On Tuesday November 13, joe@perches.com wrote:
> Remove defconfig ptr comparison to 0
> 
> Remove sparse warning: Using plain integer as NULL pointer
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> 
> ---
> 
> diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
> index d019918..07b38cf 100644
> --- a/fs/nfsd/vfs.c
> +++ b/fs/nfsd/vfs.c
> @@ -987,7 +987,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
>  	 * flushing the data to disk is handled separately below.
>  	 */
>  
> -	if (file->f_op->fsync == 0) {/* COMMIT3 cannot work */
> +	if (!file->f_op->fsync) {/* COMMIT3 cannot work */
>  	       stable = 2;
>  	       *stablep = 2; /* FILE_SYNC */
>  	}
> 

Personally, I would much rather these were changed to "== NULL".
Different people have different preferences on whether to use
    ! foo
or
    foo == NULL

and the person who wrote that code is presumably showing a preference
for the later.  Changing it from "== 0" to "== NULL" is clearly a
valuable improvement.  Changing from "== 0" to "! " is a stylistic
change that should not be made lightly.

I personally often use and prefer the explicit comparison to NULL.

NeilBrown

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-11-14  2:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-14  2:05 [PATCH] - [9/15] - remove defconfig ptr comparisons to 0 - fs/nfsd Joe Perches
2007-11-14  2:38 ` Neil Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).