[openib-general] [PATCH][7/11] IB/ipoib: use list_for_each_entry_safe when required

Roland Dreier roland at topspin.com
Wed Mar 2 21:31:22 PST 2005


From: Shirley Ma <xma at us.ibm.com>

Change uses of list_for_each_entry() where the loop variable is freed
inside the loop to list_for_each_entry_safe().

Signed-off-by: Shirley Ma <xma at us.ibm.com>
Signed-off-by: Roland Dreier <roland at topspin.com>


--- linux-export.orig/drivers/infiniband/ulp/ipoib/ipoib_multicast.c	2005-03-02 20:26:02.832873236 -0800
+++ linux-export/drivers/infiniband/ulp/ipoib/ipoib_multicast.c	2005-03-02 20:26:12.799709771 -0800
@@ -790,7 +790,7 @@
 
 	spin_unlock_irqrestore(&priv->lock, flags);
 
-	list_for_each_entry(mcast, &remove_list, list) {
+	list_for_each_entry_safe(mcast, tmcast, &remove_list, list) {
 		ipoib_mcast_leave(dev, mcast);
 		ipoib_mcast_free(mcast);
 	}
@@ -902,7 +902,7 @@
 	spin_unlock_irqrestore(&priv->lock, flags);
 
 	/* We have to cancel outside of the spinlock */
-	list_for_each_entry(mcast, &remove_list, list) {
+	list_for_each_entry_safe(mcast, tmcast, &remove_list, list) {
 		ipoib_mcast_leave(mcast->dev, mcast);
 		ipoib_mcast_free(mcast);
 	}




More information about the general mailing list