diff mbox series

[linux] nfs: Remove unnecessary ret assignment

Message ID 20211230063444.586292-1-luo.penghao@zte.com.cn (mailing list archive)
State New, archived
Headers show
Series [linux] nfs: Remove unnecessary ret assignment | expand

Commit Message

CGEL Dec. 30, 2021, 6:34 a.m. UTC
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(-)

Comments

Schumaker, Anna Jan. 5, 2022, 3:36 p.m. UTC | #1
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
>
>
diff mbox series

Patch

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)