net: use kfree_skb_list() helper
authorEric Dumazet <edumazet@google.com>
Fri, 20 Dec 2013 22:29:08 +0000 (14:29 -0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 22 Dec 2013 03:28:16 +0000 (22:28 -0500)
We can use kfree_skb_list() instead of open coding it.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/dev.c
net/core/skbuff.c

index c482fe8abf8768e54ebfa9642731216540112090..973c2365667392cf3795432a50e8cb1191276d3f 100644 (file)
@@ -2454,13 +2454,8 @@ static void dev_gso_skb_destructor(struct sk_buff *skb)
 {
        struct dev_gso_cb *cb;
 
-       do {
-               struct sk_buff *nskb = skb->next;
-
-               skb->next = nskb->next;
-               nskb->next = NULL;
-               kfree_skb(nskb);
-       } while (skb->next);
+       kfree_skb_list(skb->next);
+       skb->next = NULL;
 
        cb = DEV_GSO_CB(skb);
        if (cb->destructor)
@@ -4240,17 +4235,10 @@ EXPORT_SYMBOL(netif_napi_add);
 
 void netif_napi_del(struct napi_struct *napi)
 {
-       struct sk_buff *skb, *next;
-
        list_del_init(&napi->dev_list);
        napi_free_frags(napi);
 
-       for (skb = napi->gro_list; skb; skb = next) {
-               next = skb->next;
-               skb->next = NULL;
-               kfree_skb(skb);
-       }
-
+       kfree_skb_list(napi->gro_list);
        napi->gro_list = NULL;
        napi->gro_count = 0;
 }
index 2b6b863f51f28fa090eb09007d22c74f872821d8..eb96c2c22400dfb927e1cdfef847e629832d2f12 100644 (file)
@@ -2981,10 +2981,7 @@ perform_csum_check:
        return segs;
 
 err:
-       while ((skb = segs)) {
-               segs = skb->next;
-               kfree_skb(skb);
-       }
+       kfree_skb_list(segs);
        return ERR_PTR(err);
 }
 EXPORT_SYMBOL_GPL(skb_segment);