[OPW,kernel,1/2] staging: lustre: lustre: libcfs: Use IS_ERR_OR_NULL
diff mbox

Message ID 70f52c1e27683c299b8414c109b77c942b2d0e08.1414675234.git.tapaswenipathak@gmail.com
State New, archived
Headers show

Commit Message

Tapasweni Pathak Oct. 30, 2014, 1:22 p.m. UTC
This patch introduces the use of the macro IS_ERR_OR_NULL in place of
tests for NULL and IS_ERR.

The following Coccinelle semantic patch was used for making the change:

@@
expression e;
@@

- e == NULL || IS_ERR(e)
+ IS_ERR_OR_NULL(e)
 || ...

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
---
 .../lustre/lustre/libcfs/kernel_user_comm.c        |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
1.7.9.5

Comments

Josh Triplett Oct. 30, 2014, 1:36 p.m. UTC | #1
On Thu, Oct 30, 2014 at 06:52:02PM +0530, Tapasweni Pathak wrote:
> This patch introduces the use of the macro IS_ERR_OR_NULL in place of
> tests for NULL and IS_ERR.
> 
> The following Coccinelle semantic patch was used for making the change:
> 
> @@
> expression e;
> @@
> 
> - e == NULL || IS_ERR(e)
> + IS_ERR_OR_NULL(e)
>  || ...
> 
> Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>

Reviewed-by: Josh Triplett <josh@joshtriplett.org>

>  .../lustre/lustre/libcfs/kernel_user_comm.c        |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
> index e2aa637..e6ea8e3 100644
> --- a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
> +++ b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
> @@ -60,7 +60,7 @@ int libcfs_kkuc_msg_put(struct file *filp, void *payload)
>  	mm_segment_t fs;
>  	int rc = -ENOSYS;
> 
> -	if (filp == NULL || IS_ERR(filp))
> +	if (IS_ERR_OR_NULL(filp))
>  		return -EBADF;
> 
>  	if (kuch->kuc_magic != KUC_MAGIC) {
> --
> 1.7.9.5
> 
> -- 
> You received this message because you are subscribed to the Google Groups "opw-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to opw-kernel+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Josh Triplett Oct. 30, 2014, 1:36 p.m. UTC | #2
On Thu, Oct 30, 2014 at 06:36:01AM -0700, Josh Triplett wrote:
> On Thu, Oct 30, 2014 at 06:52:02PM +0530, Tapasweni Pathak wrote:
> > This patch introduces the use of the macro IS_ERR_OR_NULL in place of
> > tests for NULL and IS_ERR.
> > 
> > The following Coccinelle semantic patch was used for making the change:
> > 
> > @@
> > expression e;
> > @@
> > 
> > - e == NULL || IS_ERR(e)
> > + IS_ERR_OR_NULL(e)
> >  || ...
> > 
> > Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
> 
> Reviewed-by: Josh Triplett <josh@joshtriplett.org>

One nit, actually, though it isn't particularly critical: "lustre:"
shouldn't be duplicated in the subject.

> >  .../lustre/lustre/libcfs/kernel_user_comm.c        |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
> > index e2aa637..e6ea8e3 100644
> > --- a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
> > +++ b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
> > @@ -60,7 +60,7 @@ int libcfs_kkuc_msg_put(struct file *filp, void *payload)
> >  	mm_segment_t fs;
> >  	int rc = -ENOSYS;
> > 
> > -	if (filp == NULL || IS_ERR(filp))
> > +	if (IS_ERR_OR_NULL(filp))
> >  		return -EBADF;
> > 
> >  	if (kuch->kuc_magic != KUC_MAGIC) {
> > --
> > 1.7.9.5
> > 
> > -- 
> > You received this message because you are subscribed to the Google Groups "opw-kernel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to opw-kernel+unsubscribe@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.

Patch
diff mbox

diff --git a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
index e2aa637..e6ea8e3 100644
--- a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
+++ b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
@@ -60,7 +60,7 @@  int libcfs_kkuc_msg_put(struct file *filp, void *payload)
 	mm_segment_t fs;
 	int rc = -ENOSYS;

-	if (filp == NULL || IS_ERR(filp))
+	if (IS_ERR_OR_NULL(filp))
 		return -EBADF;

 	if (kuch->kuc_magic != KUC_MAGIC) {