All DSA tag receive functions need to unshare the skb before mangling it, move
this to the generic dsa_switch_rcv() function which will allow us to make the
tag receive function return their mangled skb without caring about freeing a
NULL skb.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
                return 0;
        }
 
+       skb = skb_unshare(skb, GFP_ATOMIC);
+       if (!skb)
+               return 0;
+
        return dst->rcv(skb, dev, pt, orig_dev);
 }
 
 
 
        ds = dst->cpu_switch;
 
-       skb = skb_unshare(skb, GFP_ATOMIC);
-       if (skb == NULL)
-               goto out;
-
        if (unlikely(!pskb_may_pull(skb, BRCM_TAG_LEN)))
                goto out_drop;
 
 
 out_drop:
        kfree_skb(skb);
-out:
        return 0;
 }
 
 
        int source_device;
        int source_port;
 
-       skb = skb_unshare(skb, GFP_ATOMIC);
-       if (skb == NULL)
-               goto out;
-
        if (unlikely(!pskb_may_pull(skb, DSA_HLEN)))
                goto out_drop;
 
 
 out_drop:
        kfree_skb(skb);
-out:
        return 0;
 }
 
 
        int source_device;
        int source_port;
 
-       skb = skb_unshare(skb, GFP_ATOMIC);
-       if (skb == NULL)
-               goto out;
-
        if (unlikely(!pskb_may_pull(skb, EDSA_HLEN)))
                goto out_drop;
 
 
 out_drop:
        kfree_skb(skb);
-out:
        return 0;
 }
 
 
        int port;
        __be16 *phdr, hdr;
 
-       skb = skb_unshare(skb, GFP_ATOMIC);
-       if (!skb)
-               goto out;
-
        if (unlikely(!pskb_may_pull(skb, MTK_HDR_LEN)))
                goto out_drop;
 
 
 out_drop:
        kfree_skb(skb);
-out:
        return 0;
 }
 
 
        int port;
        __be16 *phdr, hdr;
 
-       skb = skb_unshare(skb, GFP_ATOMIC);
-       if (!skb)
-               goto out;
-
        if (unlikely(!pskb_may_pull(skb, QCA_HDR_LEN)))
                goto out_drop;
 
 
 out_drop:
        kfree_skb(skb);
-out:
        return 0;
 }
 
 
 
        ds = dst->cpu_switch;
 
-       skb = skb_unshare(skb, GFP_ATOMIC);
-       if (skb == NULL)
-               goto out;
-
        if (skb_linearize(skb))
                goto out_drop;
 
 
 out_drop:
        kfree_skb(skb);
-out:
        return 0;
 }