Skip to contentSkip to conversation

ipv6: remove redundant store to value after addition

PATCH Applied Colin Ian King 3 participants 3 messages Jun 28, 2022 – Jun 30, 2022

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

PATCH 1/1 ipv6: remove redundant store to value after addition

There is no need to store the result of the addition back to variable count after the addition. The store is redundant, replace += with just +

Cleans up clang scan build warning:
warning: Although the value stored to 'count' is used in the enclosing expression, the value is never actually read from 'count'

---
 net/ipv6/route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/route.c +1 -1
index 0be01a4d48c1..1d6f75eef4bd 100644
@@ -5934,7 +5934,7 @@ int rt6_dump_route(struct fib6_info *rt, void *p_arg, unsigned int skip)
 		rcu_read_unlock();
 
 		if (err)
-			return count += w.count;
+			return count + w.count;
 	}
 
 	return -1;
Signature · 1 line
2.35.3
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines · Colin Ian King

There is no need to store the result of the addition back to variable count after the addition. The store is redundant, replace += with just +

Cleans up clang scan build warning:
warning: Although the value stored to 'count' is used in the enclosing expression, the value is never actually read from 'count'

---
 net/ipv6/route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#2 lore raw
In reply to Colin Ian King
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Hello:

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

Quoted 8 lines · On Tue, 28 Jun 2022 15:54:06 +0100 you wrote:

There is no need to store the result of the addition back to variable count after the addition. The store is redundant, replace += with just +

Cleans up clang scan build warning:
warning: Although the value stored to 'count' is used in the enclosing expression, the value is never actually read from 'count'

[...]

Here is the summary with links:
- ipv6: remove redundant store to value after addition

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

You are awesome, thank you!

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