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

ethernet/qlogic: Use list_for_each_entry() to simplify code in qlcnic_hw.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
78595dfc b55b1d50

+2 -6
+2 -6
drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
··· 460 460 int qlcnic_nic_del_mac(struct qlcnic_adapter *adapter, const u8 *addr) 461 461 { 462 462 struct qlcnic_mac_vlan_list *cur; 463 - struct list_head *head; 464 463 int err = -EINVAL; 465 464 466 465 /* Delete MAC from the existing list */ 467 - list_for_each(head, &adapter->mac_list) { 468 - cur = list_entry(head, struct qlcnic_mac_vlan_list, list); 466 + list_for_each_entry(cur, &adapter->mac_list, list) { 469 467 if (ether_addr_equal(addr, cur->mac_addr)) { 470 468 err = qlcnic_sre_macaddr_change(adapter, cur->mac_addr, 471 469 0, QLCNIC_MAC_DEL); ··· 481 483 enum qlcnic_mac_type mac_type) 482 484 { 483 485 struct qlcnic_mac_vlan_list *cur; 484 - struct list_head *head; 485 486 486 487 /* look up if already exists */ 487 - list_for_each(head, &adapter->mac_list) { 488 - cur = list_entry(head, struct qlcnic_mac_vlan_list, list); 488 + list_for_each_entry(cur, &adapter->mac_list, list) { 489 489 if (ether_addr_equal(addr, cur->mac_addr) && 490 490 cur->vlan_id == vlan) 491 491 return 0;