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

net: x25: Use list_for_each_entry() to simplify code in x25_link.c

Convert list_for_each() to list_for_each_entry() where
applicable. This simplifies the code.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Wang Hai and committed by
David S. Miller
3835a661 36861d1f

+1 -4
+1 -4
net/x25/x25_link.c
··· 332 332 struct x25_neigh *x25_get_neigh(struct net_device *dev) 333 333 { 334 334 struct x25_neigh *nb, *use = NULL; 335 - struct list_head *entry; 336 335 337 336 read_lock_bh(&x25_neigh_list_lock); 338 - list_for_each(entry, &x25_neigh_list) { 339 - nb = list_entry(entry, struct x25_neigh, node); 340 - 337 + list_for_each_entry(nb, &x25_neigh_list, node) { 341 338 if (nb->dev == dev) { 342 339 use = nb; 343 340 break;