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

qed: Fix to use list_for_each_entry_safe() when delete items

Since we will remove items off the list using list_del() we need
to use a safe version of the list_for_each_entry() macro aptly named
list_for_each_entry_safe().

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Yuval Mintz <Yuval.Mintz@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Wei Yongjun and committed by
David S. Miller
88a2428b 1e09c106

+2 -2
+2 -2
drivers/net/ethernet/qlogic/qed/qed_ll2.c
··· 1517 1517 static int qed_ll2_start(struct qed_dev *cdev, struct qed_ll2_params *params) 1518 1518 { 1519 1519 struct qed_ll2_info ll2_info; 1520 - struct qed_ll2_buffer *buffer; 1520 + struct qed_ll2_buffer *buffer, *tmp_buffer; 1521 1521 enum qed_ll2_conn_type conn_type; 1522 1522 struct qed_ptt *p_ptt; 1523 1523 int rc, i; ··· 1587 1587 1588 1588 /* Post all Rx buffers to FW */ 1589 1589 spin_lock_bh(&cdev->ll2->lock); 1590 - list_for_each_entry(buffer, &cdev->ll2->list, list) { 1590 + list_for_each_entry_safe(buffer, tmp_buffer, &cdev->ll2->list, list) { 1591 1591 rc = qed_ll2_post_rx_buffer(QED_LEADING_HWFN(cdev), 1592 1592 cdev->ll2->handle, 1593 1593 buffer->phys_addr, 0, buffer, 1);