Staging: rtl8192su: use list_for_each_safe() in ieee80211_crypto_deinit
authorFlorian Schilhabel <florian.c.schilhabel@googlemail.com>
Fri, 19 Feb 2010 19:12:12 +0000 (20:12 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 4 Mar 2010 00:43:05 +0000 (16:43 -0800)
Signed-off-by: Florian Schilhabel <florian.c.schilhabel@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/rtl8192su/TODO
drivers/staging/rtl8192su/ieee80211/ieee80211_crypt.c

index f11eec700030112e2f4cbfa699a5ddf7d1e57978..3c8da157a93c7b713a7dab944c9ab4340c4784f5 100644 (file)
@@ -4,7 +4,6 @@ TODO:
   - cleanup ieee80211.h
   - move rtl8192su's specific code out from ieee80211.h
   - abstract rtl819su's specific code
-  - use list_for_each_safe() in ieee80211_crypto_deinit
 - switch to use shared "librtl" instead of private ieee80211 stack
 - switch to use LIB80211
 - switch to use MAC80211
index 521e7b989934eae69614cfa1a74ba32ec4dcd52f..c4640e63196b0b52c48322fdcf73b9fdfdc3f22d 100644 (file)
@@ -226,19 +226,20 @@ out:
 void __exit ieee80211_crypto_deinit(void)
 {
        struct list_head *ptr, *n;
+       struct ieee80211_crypto_alg *alg = NULL;
 
        if (hcrypt == NULL)
                return;
 
-       for (ptr = hcrypt->algs.next, n = ptr->next; ptr != &hcrypt->algs;
-            ptr = n, n = ptr->next) {
-               struct ieee80211_crypto_alg *alg =
-                       (struct ieee80211_crypto_alg *) ptr;
-               list_del(ptr);
-               printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm "
-                      "'%s' (deinit)\n", alg->ops->name);
-               kfree(alg);
+       list_for_each_safe(ptr, n, &hcrypt->algs) {
+               alg = list_entry(ptr, struct ieee80211_crypto_alg, list);
+               if (alg) {
+                       list_del(ptr);
+                       printk(KERN_DEBUG
+                              "ieee80211_crypt: unregistered algorithm '%s' (deinit)\n",
+                              alg->ops->name);
+                       kfree(alg);
+               }
        }
-
        kfree(hcrypt);
 }