[PATCH][next] net/handshake: remove redundant assignment to variable ret

Colin Ian King posted 1 patch 1 year, 9 months ago
net/handshake/tlshd.c | 1 -
1 file changed, 1 deletion(-)
[PATCH][next] net/handshake: remove redundant assignment to variable ret
Posted by Colin Ian King 1 year, 9 months ago
The variable is being assigned an value and then is being re-assigned
a new value in the next statement. The assignment is redundant and can
be removed.

Cleans up clang scan build warning:
net/handshake/tlshd.c:216:2: warning: Value stored to 'ret' is never
read [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 net/handshake/tlshd.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/handshake/tlshd.c b/net/handshake/tlshd.c
index d697f68c598c..d6f52839827e 100644
--- a/net/handshake/tlshd.c
+++ b/net/handshake/tlshd.c
@@ -213,7 +213,6 @@ static int tls_handshake_accept(struct handshake_req *req,
 	if (!hdr)
 		goto out_cancel;
 
-	ret = -EMSGSIZE;
 	ret = nla_put_s32(msg, HANDSHAKE_A_ACCEPT_SOCKFD, fd);
 	if (ret < 0)
 		goto out_cancel;
-- 
2.39.2
Re: [PATCH][next] net/handshake: remove redundant assignment to variable ret
Posted by Chuck Lever 1 year, 9 months ago
On Mon, Apr 15, 2024 at 11:07:13AM +0100, Colin Ian King wrote:
> The variable is being assigned an value and then is being re-assigned
> a new value in the next statement. The assignment is redundant and can
> be removed.
> 
> Cleans up clang scan build warning:
> net/handshake/tlshd.c:216:2: warning: Value stored to 'ret' is never
> read [deadcode.DeadStores]
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  net/handshake/tlshd.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/net/handshake/tlshd.c b/net/handshake/tlshd.c
> index d697f68c598c..d6f52839827e 100644
> --- a/net/handshake/tlshd.c
> +++ b/net/handshake/tlshd.c
> @@ -213,7 +213,6 @@ static int tls_handshake_accept(struct handshake_req *req,
>  	if (!hdr)
>  		goto out_cancel;
>  
> -	ret = -EMSGSIZE;
>  	ret = nla_put_s32(msg, HANDSHAKE_A_ACCEPT_SOCKFD, fd);
>  	if (ret < 0)
>  		goto out_cancel;
> -- 
> 2.39.2
> 
> 

Acked-by: Chuck Lever <chuck.lever@oracle.com>

-- 
Chuck Lever
Re: [PATCH][next] net/handshake: remove redundant assignment to variable ret
Posted by Jason Xing 1 year, 9 months ago
On Mon, Apr 15, 2024 at 6:08 PM Colin Ian King <colin.i.king@gmail.com> wrote:
>
> The variable is being assigned an value and then is being re-assigned
> a new value in the next statement. The assignment is redundant and can
> be removed.
>
> Cleans up clang scan build warning:
> net/handshake/tlshd.c:216:2: warning: Value stored to 'ret' is never
> read [deadcode.DeadStores]
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>