Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <leitao@debian.org>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20250221-netcons_fix_shadow-v1-1-dee20c8658dd@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Breno Leitao and committed by
Jakub Kicinski
7183877d 4859851f

+2 -3
+2 -3
net/core/dev.c
··· 11209 11209 list_replace_init(&net_unlink_list, &unlink_list); 11210 11210 11211 11211 while (!list_empty(&unlink_list)) { 11212 - struct net_device *dev = list_first_entry(&unlink_list, 11213 - struct net_device, 11214 - unlink_list); 11212 + dev = list_first_entry(&unlink_list, struct net_device, 11213 + unlink_list); 11215 11214 list_del_init(&dev->unlink_list); 11216 11215 dev->nested_level = dev->lower_level - 1; 11217 11216 }