All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs: nfsd: Simplify the return expression of numeric_name_to_id
@ 2021-09-29  9:16 dingsenjie
  2021-09-29 13:13 ` J. Bruce Fields
  0 siblings, 1 reply; 2+ messages in thread
From: dingsenjie @ 2021-09-29  9:16 UTC (permalink / raw)
  To: bfields, chuck.lever; +Cc: linux-nfs, linux-kernel, dingsenjie

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



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

* Re: [PATCH] fs: nfsd: Simplify the return expression of numeric_name_to_id
  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
  0 siblings, 0 replies; 2+ messages in thread
From: J. Bruce Fields @ 2021-09-29 13:13 UTC (permalink / raw)
  To: dingsenjie; +Cc: chuck.lever, linux-nfs, linux-kernel, dingsenjie

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
> 

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

end of thread, other threads:[~2021-09-29 13:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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.