linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: dingsenjie@163.com
Cc: chuck.lever@oracle.com, linux-nfs@vger.kernel.org,
	linux-kernel@vger.kernel.org, dingsenjie <dingsenjie@yulong.com>
Subject: Re: [PATCH] fs: nfsd: Simplify the return expression of numeric_name_to_id
Date: Wed, 29 Sep 2021 09:13:43 -0400	[thread overview]
Message-ID: <20210929131343.GA20707@fieldses.org> (raw)
In-Reply-To: <20210929091626.11828-1-dingsenjie@163.com>

Well, tastes could reasonably differ, but I'd rather leave this code as
it is.

--b.

On Wed, Sep 29, 2021 at 05:16:26PM +0800, dingsenjie@163.com wrote:
> From: dingsenjie <dingsenjie@yulong.com>
> 
> Simplify the return expression in the nfs4idmap.c
> 
> Signed-off-by: dingsenjie <dingsenjie@yulong.com>
> ---
>  fs/nfsd/nfs4idmap.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c
> index f92161c..dc5926c 100644
> --- a/fs/nfsd/nfs4idmap.c
> +++ b/fs/nfsd/nfs4idmap.c
> @@ -603,7 +603,6 @@ static __be32 idmap_id_to_name(struct xdr_stream *xdr,
>  static bool
>  numeric_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen, u32 *id)
>  {
> -	int ret;
>  	char buf[11];
>  
>  	if (namelen + 1 > sizeof(buf))
> @@ -612,8 +611,7 @@ static __be32 idmap_id_to_name(struct xdr_stream *xdr,
>  	/* Just to make sure it's null-terminated: */
>  	memcpy(buf, name, namelen);
>  	buf[namelen] = '\0';
> -	ret = kstrtouint(buf, 10, id);
> -	return ret == 0;
> +	return kstrtouint(buf, 10, id) == 0;
>  }
>  
>  static __be32
> -- 
> 1.9.1
> 

      reply	other threads:[~2021-09-29 13:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-29  9:16 [PATCH] fs: nfsd: Simplify the return expression of numeric_name_to_id dingsenjie
2021-09-29 13:13 ` J. Bruce Fields [this message]

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=20210929131343.GA20707@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=dingsenjie@163.com \
    --cc=dingsenjie@yulong.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).