Re: [PATCH 1/1] GFS2: Deletion of unnecessary checks before two function calls

Steven Whitehouse
2014-11-18T11:05:35Z

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;
> }
>