aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorBreno Leitao <[email protected]>2025-02-21 17:51:27 +0000
committerJakub Kicinski <[email protected]>2025-02-24 22:34:54 +0000
commit7183877d6853801258b7a8d3b51b415982e5097e (patch)
tree1dfb7abeeb2630f2c010b55e589887cf36589451 /net/core/dev.c
parentMerge branch 'net-stmmac-thead-clean-up-clock-rate-setting' (diff)
downloadkernel-7183877d6853801258b7a8d3b51b415982e5097e.tar.gz
kernel-7183877d6853801258b7a8d3b51b415982e5097e.zip
net: Remove shadow variable in netdev_run_todo()
Fix a shadow variable warning in net/core/dev.c when compiled with CONFIG_LOCKDEP enabled. The warning occurs because 'dev' is redeclared inside the while loop, shadowing the outer scope declaration. net/core/dev.c:11211:22: warning: declaration shadows a local variable [-Wshadow] struct net_device *dev = list_first_entry(&unlink_list, net/core/dev.c:11202:21: note: previous declaration is here struct net_device *dev, *tmp; Remove the redundant declaration since the variable is already defined in the outer scope and will be overwritten in the subsequent list_for_each_entry_safe() loop anyway. Signed-off-by: Breno Leitao <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 8c7ee7ada6a3..3f525278a871 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -11209,9 +11209,8 @@ void netdev_run_todo(void)
list_replace_init(&net_unlink_list, &unlink_list);
while (!list_empty(&unlink_list)) {
- struct net_device *dev = list_first_entry(&unlink_list,
- struct net_device,
- unlink_list);
+ dev = list_first_entry(&unlink_list, struct net_device,
+ unlink_list);
list_del_init(&dev->unlink_list);
dev->nested_level = dev->lower_level - 1;
}