All of 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
  0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2007-11-14  2:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: J. Bruce Fields, Neil Brown, Linus Torvalds, 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 */
 	}



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

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

* [PATCH] - [9/15] - remove defconfig ptr comparisons to 0 - fs/nfsd
@ 2007-11-14  2:05 ` Joe Perches
  0 siblings, 0 replies; 4+ 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 related	[flat|nested] 4+ messages in thread

* Re: [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
  -1 siblings, 0 replies; 4+ messages in thread
From: Neil Brown @ 2007-11-14  2:38 UTC (permalink / raw)
  To: Joe Perches; +Cc: J. Bruce Fields, nfs, Linus Torvalds, linux-kernel

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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

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

* Re: [PATCH] - [9/15] - remove defconfig ptr comparisons to 0 - fs/nfsd
@ 2007-11-14  2:38   ` Neil Brown
  0 siblings, 0 replies; 4+ 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] 4+ messages in thread

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

Thread overview: 4+ 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:05 ` Joe Perches
2007-11-14  2:38 ` Neil Brown
2007-11-14  2:38   ` Neil Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.