brcm80211: util: remove pointer traversal from brcmu_pkt_buf_free_skb
authorArend van Spriel <arend@broadcom.com>
Thu, 10 Nov 2011 19:30:30 +0000 (20:30 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 11 Nov 2011 19:28:43 +0000 (14:28 -0500)
The function brcmu_pkt_buf_free_skb() was following the next pointer
to free all linked packets. However, it is only called with unlinked
packets so this can be removed.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Alwin Beukers <alwin@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/brcm80211/brcmutil/utils.c

index 3a92f72caef7b4cdfe144b810602f02a926ef549..b7537f70a79538fab66fd48183179c4b78a2f78a 100644 (file)
@@ -41,28 +41,17 @@ EXPORT_SYMBOL(brcmu_pkt_buf_get_skb);
 /* Free the driver packet. Free the tag if present */
 void brcmu_pkt_buf_free_skb(struct sk_buff *skb)
 {
-       struct sk_buff *nskb;
-       int nest = 0;
-
-       /* perversion: we use skb->next to chain multi-skb packets */
-       while (skb) {
-               nskb = skb->next;
-               skb->next = NULL;
-
-               if (skb->destructor)
-                       /* cannot kfree_skb() on hard IRQ (net/core/skbuff.c) if
-                        * destructor exists
-                        */
-                       dev_kfree_skb_any(skb);
-               else
-                       /* can free immediately (even in_irq()) if destructor
-                        * does not exist
-                        */
-                       dev_kfree_skb(skb);
-
-               nest++;
-               skb = nskb;
-       }
+       WARN_ON(skb->next);
+       if (skb->destructor)
+               /* cannot kfree_skb() on hard IRQ (net/core/skbuff.c) if
+                * destructor exists
+                */
+               dev_kfree_skb_any(skb);
+       else
+               /* can free immediately (even in_irq()) if destructor
+                * does not exist
+                */
+               dev_kfree_skb(skb);
 }
 EXPORT_SYMBOL(brcmu_pkt_buf_free_skb);