linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux] nfs: Remove unnecessary ret assignment
@ 2021-12-30  6:34 cgel.zte
  2022-01-05 15:36 ` Anna Schumaker
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2021-12-30  6:34 UTC (permalink / raw)
  To: Trond Myklebust
  Cc: Anna Schumaker, linux-nfs, linux-kernel, luo penghao, Zeal Robot

From: luo penghao <luo.penghao@zte.com.cn>

Subsequent if judgments will assign new values to ret, so the
statement here should be deleted

The clang_analyzer complains as follows:

fs/nfs/callback.c:

Value stored to 'ret' is never read

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: luo penghao <luo.penghao@zte.com.cn>
---
 fs/nfs/callback.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index 86d856d..1c1c82a 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -209,7 +209,6 @@ static int nfs_callback_up_net(int minorversion, struct svc_serv *serv,
 		goto err_bind;
 	}
 
-	ret = 0;
 	if (!IS_ENABLED(CONFIG_NFS_V4_1) || minorversion == 0)
 		ret = nfs4_callback_up_net(serv, net);
 	else if (xprt->ops->bc_setup)
-- 
2.15.2



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

* Re: [PATCH linux] nfs: Remove unnecessary ret assignment
  2021-12-30  6:34 [PATCH linux] nfs: Remove unnecessary ret assignment cgel.zte
@ 2022-01-05 15:36 ` Anna Schumaker
  0 siblings, 0 replies; 2+ messages in thread
From: Anna Schumaker @ 2022-01-05 15:36 UTC (permalink / raw)
  To: cgel.zte
  Cc: Trond Myklebust, Linux NFS Mailing List,
	Linux Kernel Mailing List, luo penghao, Zeal Robot

Hi Luo,

On Fri, Dec 31, 2021 at 5:05 AM <cgel.zte@gmail.com> wrote:
>
> From: luo penghao <luo.penghao@zte.com.cn>
>
> Subsequent if judgments will assign new values to ret, so the
> statement here should be deleted
>
> The clang_analyzer complains as follows:
>
> fs/nfs/callback.c:
>
> Value stored to 'ret' is never read

The "else if (xprt->ops->bc_setup)" branch doesn't touch 'ret', so it
seems to me like the clang_analyzer is falsely reporting this.

Thanks,
Anna
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: luo penghao <luo.penghao@zte.com.cn>
> ---
>  fs/nfs/callback.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
> index 86d856d..1c1c82a 100644
> --- a/fs/nfs/callback.c
> +++ b/fs/nfs/callback.c
> @@ -209,7 +209,6 @@ static int nfs_callback_up_net(int minorversion, struct svc_serv *serv,
>                 goto err_bind;
>         }
>
> -       ret = 0;
>         if (!IS_ENABLED(CONFIG_NFS_V4_1) || minorversion == 0)
>                 ret = nfs4_callback_up_net(serv, net);
>         else if (xprt->ops->bc_setup)
> --
> 2.15.2
>
>

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

end of thread, other threads:[~2022-01-05 15:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-30  6:34 [PATCH linux] nfs: Remove unnecessary ret assignment cgel.zte
2022-01-05 15:36 ` Anna Schumaker

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).