All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Staging: lustre: lmv_obd: Remove redundant if-statement.
@ 2016-09-17 22:59 Sandhya Bankar
       [not found] ` <93FE0E54-2D38-465C-BD4B-05A648FC8362@intel.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Sandhya Bankar @ 2016-09-17 22:59 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: oleg.drokin, andreas.dilger, jsimmons, gregkh

Remove redundant if-statement.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
---
Changes in v2:
* Correcting the file permission issue.
 drivers/staging/lustre/lustre/lmv/lmv_obd.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index 5783359..0713e55 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -949,10 +949,8 @@ static int lmv_hsm_ct_register(struct lmv_obd *lmv, unsigned int cmd, int len,
 
 	rc = libcfs_kkuc_group_add(filp, lk->lk_uid, lk->lk_group,
 				   &kcd, sizeof(kcd));
-	if (rc) {
-		if (filp)
-			fput(filp);
-	}
+	if (rc && filp)
+		fput(filp);
 
 	return rc;
 }
-- 
1.7.1



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

* Re: [PATCH v2] Staging: lustre: lmv_obd: Remove redundant if-statement.
       [not found] ` <93FE0E54-2D38-465C-BD4B-05A648FC8362@intel.com>
@ 2016-09-19 15:30   ` sandhya bankar
  0 siblings, 0 replies; 2+ messages in thread
From: sandhya bankar @ 2016-09-19 15:30 UTC (permalink / raw)
  To: Dilger, Andreas
  Cc: outreachy-kernel@googlegroups.com, Drokin, Oleg,
	jsimmons@infradead.org, gregkh@linuxfoundation.org

[-- Attachment #1: Type: text/plain, Size: 1499 bytes --]

Thanks Andreas ! I will send a patch with your suggestion.

On Mon, Sep 19, 2016 at 3:17 AM, Dilger, Andreas <andreas.dilger@intel.com>
wrote:

> On Sep 18, 2016, at 00:59, Sandhya Bankar <bankarsandhya512@gmail.com>
> wrote:
> >
> > Remove redundant if-statement.
> >
> > Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
> > ---
> > Changes in v2:
> > * Correcting the file permission issue.
> > drivers/staging/lustre/lustre/lmv/lmv_obd.c |    6 ++----
> > 1 files changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
> b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
> > index 5783359..0713e55 100644
> > --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
> > +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
> > @@ -949,10 +949,8 @@ static int lmv_hsm_ct_register(struct lmv_obd *lmv,
> unsigned int cmd, int len,
> >
> >       rc = libcfs_kkuc_group_add(filp, lk->lk_uid, lk->lk_group,
> >                                  &kcd, sizeof(kcd));
> > -     if (rc) {
> > -             if (filp)
> > -                     fput(filp);
> > -     }
> > +     if (rc && filp)
> > +             fput(filp);
>
> In fact, the check for filp != NULL is also redundant.  A few lines
> earlier:
>
>         /* at least one registration done, with no failure */
>         filp = fget(lk->lk_wfd);
>         if (!filp)
>                 return -EBADF;
>
> so it cannot be NULL at this point, and the check should just be removed.
>
> Cheers, Andreas

[-- Attachment #2: Type: text/html, Size: 2226 bytes --]

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

end of thread, other threads:[~2016-09-19 15:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-17 22:59 [PATCH v2] Staging: lustre: lmv_obd: Remove redundant if-statement Sandhya Bankar
     [not found] ` <93FE0E54-2D38-465C-BD4B-05A648FC8362@intel.com>
2016-09-19 15:30   ` sandhya bankar

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.