net: hns3: clear param in ring when free ring
authorPeng Li <lipeng321@huawei.com>
Tue, 22 Jan 2019 23:39:33 +0000 (07:39 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 23 Jan 2019 19:13:01 +0000 (11:13 -0800)
Param pending_buf and skb may be not NULL when free ring.
This patch clears them when free ring.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c

index 544f0d2..327dde2 100644 (file)
@@ -3397,6 +3397,11 @@ static void hns3_fini_ring(struct hns3_enet_ring *ring)
        ring->desc_cb = NULL;
        ring->next_to_clean = 0;
        ring->next_to_use = 0;
+       ring->pending_buf = 0;
+       if (ring->skb) {
+               dev_kfree_skb_any(ring->skb);
+               ring->skb = NULL;
+       }
 }
 
 static int hns3_buf_size2type(u32 buf_size)