Skip to contentSkip to conversation

net/handshake: remove redundant assignment to variable ret

PATCH Applied Colin Ian King 4 participants 4 messages Apr 15, 2024 – Apr 17, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/handshake: remove redundant assignment to variable ret

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]

---
 net/handshake/tlshd.c | 1 -
 1 file changed, 1 deletion(-)
net/handshake/tlshd.c +0 -1
index d697f68c598c..d6f52839827e 100644
@@ -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;
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Colin Ian King

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]

Acked-by on v1 1/1
#2 lore raw
In reply to Colin Ian King
Quoted 29 lines · Colin Ian King

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]

---
 net/handshake/tlshd.c | 1 -
 1 file changed, 1 deletion(-)
net/handshake/tlshd.c +0 -1
index d697f68c598c..d6f52839827e 100644
@@ -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;
Signature · 1 line
2.39.2
Signature · 1 line
Chuck Lever
#3 lore raw
In reply to Colin Ian King
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Mon, 15 Apr 2024 11:07:13 +0100 you 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]

[...]

Here is the summary with links:
- [next] net/handshake: remove redundant assignment to variable ret

    https://git.kernel.org/netdev/net-next/c/c2b640529ec7

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html