mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: cgel.zte@gmail.com, mark@fasheh.com
Cc: jlbec@evilplan.org, ocfs2-devel@oss.oracle.com,
	linux-kernel@vger.kernel.org,
	Minghao Chi <chi.minghao@zte.com.cn>,
	Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH] fs/ocfs2: remove redundant ret variable
Date: Wed, 5 Jan 2022 10:04:21 +0800	[thread overview]
Message-ID: <a96a59c2-101c-4576-b76b-d9923fca25af@linux.alibaba.com> (raw)
In-Reply-To: <20220104112332.601834-1-chi.minghao@zte.com.cn>



On 1/4/22 7:23 PM, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> Return value from dlm_lock() directly instead
> of taking this in another redundant variable.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> Signed-off-by: CGEL ZTE <cgel.zte@gmail.com>
> ---
>  fs/ocfs2/stack_user.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
> index 85a47621e0c0..3027a6a05668 100644
> --- a/fs/ocfs2/stack_user.c
> +++ b/fs/ocfs2/stack_user.c
> @@ -683,28 +683,23 @@ static int user_dlm_lock(struct ocfs2_cluster_connection *conn,
>  			 void *name,
>  			 unsigned int namelen)
>  {
> -	int ret;
> -
>  	if (!lksb->lksb_fsdlm.sb_lvbptr)
>  		lksb->lksb_fsdlm.sb_lvbptr = (char *)lksb +
>  					     sizeof(struct dlm_lksb);
>  
> -	ret = dlm_lock(conn->cc_lockspace, mode, &lksb->lksb_fsdlm,
> +	return dlm_lock(conn->cc_lockspace, mode, &lksb->lksb_fsdlm,
>  		       flags|DLM_LKF_NODLCKWT, name, namelen, 0,
>  		       fsdlm_lock_ast_wrapper, lksb,
>  		       fsdlm_blocking_ast_wrapper);

Better to align the parameters as well.

Thanks,
Joseph

> -	return ret;
>  }
>  
>  static int user_dlm_unlock(struct ocfs2_cluster_connection *conn,
>  			   struct ocfs2_dlm_lksb *lksb,
>  			   u32 flags)
>  {
> -	int ret;
>  
> -	ret = dlm_unlock(conn->cc_lockspace, lksb->lksb_fsdlm.sb_lkid,
> +	return dlm_unlock(conn->cc_lockspace, lksb->lksb_fsdlm.sb_lkid,
>  			 flags, &lksb->lksb_fsdlm, lksb);
> -	return ret;
>  }
>  
>  static int user_dlm_lock_status(struct ocfs2_dlm_lksb *lksb)

  reply	other threads:[~2022-01-05  2:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-04 11:23 cgel.zte
2022-01-05  2:04 ` Joseph Qi [this message]
2022-01-12  8:14 cgel.zte
2022-01-12 11:19 ` Joseph Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a96a59c2-101c-4576-b76b-d9923fca25af@linux.alibaba.com \
    --to=joseph.qi@linux.alibaba.com \
    --cc=cgel.zte@gmail.com \
    --cc=chi.minghao@zte.com.cn \
    --cc=jlbec@evilplan.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@fasheh.com \
    --cc=ocfs2-devel@oss.oracle.com \
    --cc=zealci@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®