* [Cluster-devel] [PATCH 1/1] GFS2: Deletion of unnecessary checks before two function calls [not found] ` <5317A59D.4@users.sourceforge.net> @ 2014-11-18 10:35 ` SF Markus Elfring 2014-11-18 11:05 ` Steven Whitehouse 2014-11-29 17:00 ` [Cluster-devel] [PATCH 1/1] fs-DLM: Deletion of unnecessary checks before the function call "kfree" SF Markus Elfring 1 sibling, 1 reply; 7+ messages in thread From: SF Markus Elfring @ 2014-11-18 10:35 UTC (permalink / raw) To: cluster-devel.redhat.com From: Markus Elfring <elfring@users.sourceforge.net> Date: Tue, 18 Nov 2014 11:31:23 +0100 The functions iput() and put_pid() test whether their argument is NULL and then return immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- fs/gfs2/glock.c | 3 +-- fs/gfs2/ops_fstype.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 7f513b1..f4aa085 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -836,8 +836,7 @@ void gfs2_holder_reinit(unsigned int state, unsigned flags, struct gfs2_holder * gh->gh_flags = flags; gh->gh_iflags = 0; gh->gh_ip = (unsigned long)__builtin_return_address(0); - if (gh->gh_owner_pid) - put_pid(gh->gh_owner_pid); + put_pid(gh->gh_owner_pid); gh->gh_owner_pid = get_pid(task_pid(current)); } diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index d3eae24..272ff81 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c @@ -918,8 +918,7 @@ fail_qc_i: fail_ut_i: iput(sdp->sd_sc_inode); fail: - if (pn) - iput(pn); + iput(pn); return error; } -- 2.1.3 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Cluster-devel] [PATCH 1/1] GFS2: Deletion of unnecessary checks before two function calls 2014-11-18 10:35 ` [Cluster-devel] [PATCH 1/1] GFS2: Deletion of unnecessary checks before two function calls SF Markus Elfring @ 2014-11-18 11:05 ` Steven Whitehouse 2015-11-04 20:27 ` [Cluster-devel] [PATCH] GFS2: Delete an unnecessary check before the function call "iput" SF Markus Elfring 0 siblings, 1 reply; 7+ messages in thread From: Steven Whitehouse @ 2014-11-18 11:05 UTC (permalink / raw) To: cluster-devel.redhat.com Hi, Now in the GFS2 -nmw git tree. Thanks, Steve. On 18/11/14 10:35, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Tue, 18 Nov 2014 11:31:23 +0100 > > The functions iput() and put_pid() test whether their argument is NULL > and then return immediately. Thus the test around the call is not needed. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> > --- > fs/gfs2/glock.c | 3 +-- > fs/gfs2/ops_fstype.c | 3 +-- > 2 files changed, 2 insertions(+), 4 deletions(-) > > diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c > index 7f513b1..f4aa085 100644 > --- a/fs/gfs2/glock.c > +++ b/fs/gfs2/glock.c > @@ -836,8 +836,7 @@ void gfs2_holder_reinit(unsigned int state, unsigned flags, struct gfs2_holder * > gh->gh_flags = flags; > gh->gh_iflags = 0; > gh->gh_ip = (unsigned long)__builtin_return_address(0); > - if (gh->gh_owner_pid) > - put_pid(gh->gh_owner_pid); > + put_pid(gh->gh_owner_pid); > gh->gh_owner_pid = get_pid(task_pid(current)); > } > > diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c > index d3eae24..272ff81 100644 > --- a/fs/gfs2/ops_fstype.c > +++ b/fs/gfs2/ops_fstype.c > @@ -918,8 +918,7 @@ fail_qc_i: > fail_ut_i: > iput(sdp->sd_sc_inode); > fail: > - if (pn) > - iput(pn); > + iput(pn); > return error; > } > ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cluster-devel] [PATCH] GFS2: Delete an unnecessary check before the function call "iput" 2014-11-18 11:05 ` Steven Whitehouse @ 2015-11-04 20:27 ` SF Markus Elfring 2015-11-13 14:06 ` Bob Peterson 2015-11-16 18:11 ` Bob Peterson 0 siblings, 2 replies; 7+ messages in thread From: SF Markus Elfring @ 2015-11-04 20:27 UTC (permalink / raw) To: cluster-devel.redhat.com From: Markus Elfring <elfring@users.sourceforge.net> Date: Wed, 4 Nov 2015 21:23:43 +0100 The iput() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- fs/gfs2/ops_fstype.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index baab99b..1f9de17 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c @@ -910,8 +910,7 @@ fail_qc_i: fail_ut_i: iput(sdp->sd_sc_inode); fail: - if (pn) - iput(pn); + iput(pn); return error; } -- 2.6.2 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Cluster-devel] [PATCH] GFS2: Delete an unnecessary check before the function call "iput" 2015-11-04 20:27 ` [Cluster-devel] [PATCH] GFS2: Delete an unnecessary check before the function call "iput" SF Markus Elfring @ 2015-11-13 14:06 ` Bob Peterson 2015-11-16 18:11 ` Bob Peterson 1 sibling, 0 replies; 7+ messages in thread From: Bob Peterson @ 2015-11-13 14:06 UTC (permalink / raw) To: cluster-devel.redhat.com ----- Original Message ----- > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Wed, 4 Nov 2015 21:23:43 +0100 > > The iput() function tests whether its argument is NULL and then > returns immediately. Thus the test around the call is not needed. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> > --- > fs/gfs2/ops_fstype.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c > index baab99b..1f9de17 100644 > --- a/fs/gfs2/ops_fstype.c > +++ b/fs/gfs2/ops_fstype.c > @@ -910,8 +910,7 @@ fail_qc_i: > fail_ut_i: > iput(sdp->sd_sc_inode); > fail: > - if (pn) > - iput(pn); > + iput(pn); > return error; > } > > -- > 2.6.2 > > Hi Markus, ACK, I'll save this patch and push it after the current merge window closed. Regards, Bob Peterson Red Hat File Systems ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cluster-devel] [PATCH] GFS2: Delete an unnecessary check before the function call "iput" 2015-11-04 20:27 ` [Cluster-devel] [PATCH] GFS2: Delete an unnecessary check before the function call "iput" SF Markus Elfring 2015-11-13 14:06 ` Bob Peterson @ 2015-11-16 18:11 ` Bob Peterson 1 sibling, 0 replies; 7+ messages in thread From: Bob Peterson @ 2015-11-16 18:11 UTC (permalink / raw) To: cluster-devel.redhat.com ----- Original Message ----- > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Wed, 4 Nov 2015 21:23:43 +0100 > > The iput() function tests whether its argument is NULL and then > returns immediately. Thus the test around the call is not needed. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> > --- > fs/gfs2/ops_fstype.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c > index baab99b..1f9de17 100644 > --- a/fs/gfs2/ops_fstype.c > +++ b/fs/gfs2/ops_fstype.c > @@ -910,8 +910,7 @@ fail_qc_i: > fail_ut_i: > iput(sdp->sd_sc_inode); > fail: > - if (pn) > - iput(pn); > + iput(pn); > return error; > } > > -- > 2.6.2 > > -- Hi, Thanks. This is now applied to the for-next branch of the linux-gfs2 tree: https://git.kernel.org/cgit/linux/kernel/git/gfs2/linux-gfs2.git/commit/fs/gfs2?h=for-next&id=6fde22426be6af261816db5941744b8d3c4c7f96 Regards, Bob Peterson Red Hat File Systems ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cluster-devel] [PATCH 1/1] fs-DLM: Deletion of unnecessary checks before the function call "kfree" [not found] ` <5317A59D.4@users.sourceforge.net> 2014-11-18 10:35 ` [Cluster-devel] [PATCH 1/1] GFS2: Deletion of unnecessary checks before two function calls SF Markus Elfring @ 2014-11-29 17:00 ` SF Markus Elfring 2015-06-26 12:05 ` [Cluster-devel] [PATCH] fs-DLM: Delete " SF Markus Elfring 1 sibling, 1 reply; 7+ messages in thread From: SF Markus Elfring @ 2014-11-29 17:00 UTC (permalink / raw) To: cluster-devel.redhat.com From: Markus Elfring <elfring@users.sourceforge.net> Date: Sat, 29 Nov 2014 17:55:39 +0100 The kfree() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- fs/dlm/lockspace.c | 3 +-- fs/dlm/memory.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index f3e7278..b660b93 100644 --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c @@ -674,8 +674,7 @@ static int new_lockspace(const char *name, const char *cluster, out_lkbidr: idr_destroy(&ls->ls_lkbidr); for (i = 0; i < DLM_REMOVE_NAMES_MAX; i++) { - if (ls->ls_remove_names[i]) - kfree(ls->ls_remove_names[i]); + kfree(ls->ls_remove_names[i]); } out_rsbtbl: vfree(ls->ls_rsbtbl); diff --git a/fs/dlm/memory.c b/fs/dlm/memory.c index 7cd24bc..2d2eaa0 100644 --- a/fs/dlm/memory.c +++ b/fs/dlm/memory.c @@ -86,8 +86,7 @@ void dlm_free_lkb(struct dlm_lkb *lkb) struct dlm_user_args *ua; ua = lkb->lkb_ua; if (ua) { - if (ua->lksb.sb_lvbptr) - kfree(ua->lksb.sb_lvbptr); + kfree(ua->lksb.sb_lvbptr); kfree(ua); } } -- 2.1.3 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Cluster-devel] [PATCH] fs-DLM: Delete unnecessary checks before the function call "kfree" 2014-11-29 17:00 ` [Cluster-devel] [PATCH 1/1] fs-DLM: Deletion of unnecessary checks before the function call "kfree" SF Markus Elfring @ 2015-06-26 12:05 ` SF Markus Elfring 0 siblings, 0 replies; 7+ messages in thread From: SF Markus Elfring @ 2015-06-26 12:05 UTC (permalink / raw) To: cluster-devel.redhat.com From: Markus Elfring <elfring@users.sourceforge.net> Date: Fri, 26 Jun 2015 14:00:06 +0200 The kfree() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- fs/dlm/lockspace.c | 6 ++---- fs/dlm/memory.c | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index f3e7278..41c53b3 100644 --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c @@ -673,10 +673,8 @@ static int new_lockspace(const char *name, const char *cluster, kfree(ls->ls_recover_buf); out_lkbidr: idr_destroy(&ls->ls_lkbidr); - for (i = 0; i < DLM_REMOVE_NAMES_MAX; i++) { - if (ls->ls_remove_names[i]) - kfree(ls->ls_remove_names[i]); - } + for (i = 0; i < DLM_REMOVE_NAMES_MAX; i++) + kfree(ls->ls_remove_names[i]); out_rsbtbl: vfree(ls->ls_rsbtbl); out_lsfree: diff --git a/fs/dlm/memory.c b/fs/dlm/memory.c index 7cd24bc..2d2eaa0 100644 --- a/fs/dlm/memory.c +++ b/fs/dlm/memory.c @@ -86,8 +86,7 @@ void dlm_free_lkb(struct dlm_lkb *lkb) struct dlm_user_args *ua; ua = lkb->lkb_ua; if (ua) { - if (ua->lksb.sb_lvbptr) - kfree(ua->lksb.sb_lvbptr); + kfree(ua->lksb.sb_lvbptr); kfree(ua); } } -- 2.4.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-11-16 18:11 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <5307CAA2.8060406@users.sourceforge.net> [not found] ` <alpine.DEB.2.02.1402212321410.2043@localhost6.localdomain6> [not found] ` <530A086E.8010901@users.sourceforge.net> [not found] ` <alpine.DEB.2.02.1402231635510.1985@localhost6.localdomain6> [not found] ` <530A72AA.3000601@users.sourceforge.net> [not found] ` <alpine.DEB.2.02.1402240658210.2090@localhost6.localdomain6> [not found] ` <530B5FB6.6010207@users.sourceforge.net> [not found] ` <alpine.DEB.2.10.1402241710370.2074@hadrien> [not found] ` <530C5E18.1020800@users.sourceforge.net> [not found] ` <alpine.DEB.2.10.1402251014170.2080@hadrien> [not found] ` <530CD2C4.4050903@users.sourceforge.net> [not found] ` <alpine.DEB.2.10.1402251840450.7035@hadrien> [not found] ` <530CF8FF.8080600@users.sourceforge.net> [not found] ` <alpine.DEB.2.02.1402252117150.2047@localhost6.localdomain6> [not found] ` <530DD06F.4090703@users.sourceforge.net> [not found] ` <alpine.DEB.2.02.1402262129250.2221@localhost6.localdomain6> [not found] ` <5317A59D.4@users.sourceforge.net> 2014-11-18 10:35 ` [Cluster-devel] [PATCH 1/1] GFS2: Deletion of unnecessary checks before two function calls SF Markus Elfring 2014-11-18 11:05 ` Steven Whitehouse 2015-11-04 20:27 ` [Cluster-devel] [PATCH] GFS2: Delete an unnecessary check before the function call "iput" SF Markus Elfring 2015-11-13 14:06 ` Bob Peterson 2015-11-16 18:11 ` Bob Peterson 2014-11-29 17:00 ` [Cluster-devel] [PATCH 1/1] fs-DLM: Deletion of unnecessary checks before the function call "kfree" SF Markus Elfring 2015-06-26 12:05 ` [Cluster-devel] [PATCH] fs-DLM: Delete " SF Markus Elfring
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).