Skip to content

Commit

Permalink
brcm80211: util: remove pointer traversal from brcmu_pkt_buf_free_skb
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Arend van Spriel authored and John W. Linville committed Nov 11, 2011
1 parent 9a95e60 commit 53ee4bc
Showing 1 changed file with 11 additions and 22 deletions.
33 changes: 11 additions & 22 deletions drivers/net/wireless/brcm80211/brcmutil/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 53ee4bc

Please sign in to comment.