Skip to contentSkip to conversation

net: vxlan: remove duplicated initialization in vxlan_xmit

PATCH Applied Menglong Dong 3 participants 3 messages Aug 10, 2024 – Aug 12, 2024

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

PATCH 1/1 net: vxlan: remove duplicated initialization in vxlan_xmit

The variable "did_rsc" is initialized twice, which is unnecessary. Just remove one of them.

---
 drivers/net/vxlan/vxlan_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/vxlan/vxlan_core.c +1 -1
index fa3c4e08044a..0ddb2eca744d 100644
@@ -2710,11 +2710,11 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	struct vxlan_rdst *rdst, *fdst = NULL;
 	const struct ip_tunnel_info *info;
-	bool did_rsc = false;
 	struct vxlan_fdb *f;
 	struct ethhdr *eth;
 	__be32 vni = 0;
 	u32 nhid = 0;
+	bool did_rsc;
 
 	info = skb_tunnel_info(skb);
 
Signature · 1 line
2.39.2
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Menglong Dong

The variable "did_rsc" is initialized twice, which is unnecessary. Just remove one of them.

Thanks, I have verified that did_rsc is initialised to false, else where in this function, before it is otherwise used.

And, as the function may return before then, it does seem reasonable to defer initialisation until then.

#2 lore raw
In reply to Menglong Dong
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Hello:

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

Quoted 7 lines · On Sat, 10 Aug 2024 10:06:32 +0800 you wrote:

The variable "did_rsc" is initialized twice, which is unnecessary. Just remove one of them.

---
 drivers/net/vxlan/vxlan_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
- [net-next] net: vxlan: remove duplicated initialization in vxlan_xmit

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

You are awesome, thank you!

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