net: qede: Use list_for_each_entry() to simplify code
authorWang Hai <wanghai38@huawei.com>
Tue, 8 Jun 2021 07:57:37 +0000 (07:57 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 8 Jun 2021 23:31:24 +0000 (16:31 -0700)
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>
drivers/net/ethernet/qlogic/qede/qede_rdma.c

index 2f65980..6304514 100644 (file)
@@ -247,12 +247,10 @@ static struct qede_rdma_event_work *
 qede_rdma_get_free_event_node(struct qede_dev *edev)
 {
        struct qede_rdma_event_work *event_node = NULL;
-       struct list_head *list_node = NULL;
        bool found = false;
 
-       list_for_each(list_node, &edev->rdma_info.rdma_event_list) {
-               event_node = list_entry(list_node, struct qede_rdma_event_work,
-                                       list);
+       list_for_each_entry(event_node, &edev->rdma_info.rdma_event_list,
+                           list) {
                if (!work_pending(&event_node->work)) {
                        found = true;
                        break;