[PATCH] libertas: fix oops on rmmod
authorMarcelo Tosatti <mtosatti@redhat.com>
Fri, 25 May 2007 20:28:20 +0000 (16:28 -0400)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 11 Jun 2007 18:28:42 +0000 (14:28 -0400)
Use list_for_each_entry_safe, to protect against list_del().

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/libertas/if_usb.c

index 10698a1c1c30e19b5fad5b2529ee619defe6cac1..de7a2e2babe656f9264196a7e8ec4e1c6f445eb9 100644 (file)
@@ -970,15 +970,12 @@ static int if_usb_init_module(void)
 
 static void if_usb_exit_module(void)
 {
-       struct list_head *ptr;
-       struct usb_card_rec *cardp;
+       struct usb_card_rec *cardp, *cardp_temp;
 
        lbs_deb_enter(LBS_DEB_MAIN);
 
-       list_for_each(ptr, &usb_devices) {
-               cardp = list_entry(ptr, struct usb_card_rec, list);
+       list_for_each_entry_safe(cardp, cardp_temp, &usb_devices, list)
                if_usb_reset_device((wlan_private *) cardp->priv);
-       }
 
        /* API unregisters the driver from USB subsystem */
        usb_deregister(&if_usb_driver);