Blob Blame History Raw
From: Huazhong Tan <tanhuazhong@huawei.com>
Date: Thu, 4 Apr 2019 16:17:58 +0800
Subject: net: hns3: modify HNS3_NIC_STATE_INITED flag in
 hns3_reset_notify_uninit_enet
Patch-mainline: v5.2-rc1
Git-commit: 1eeb3367897a3f9f852e186695e28bb623b09f92
References: bsc#1104353 FATE#326415

In the hns3_reset_notify_uninit_enet() HNS3_NIC_STATE_INITED flag
should be checked and cleared firstly.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -4127,7 +4127,7 @@ static int hns3_reset_notify_uninit_enet
 	struct hns3_nic_priv *priv = netdev_priv(netdev);
 	int ret;
 
-	if (!test_bit(HNS3_NIC_STATE_INITED, &priv->state)) {
+	if (!test_and_clear_bit(HNS3_NIC_STATE_INITED, &priv->state)) {
 		netdev_warn(netdev, "already uninitialized\n");
 		return 0;
 	}
@@ -4149,8 +4149,6 @@ static int hns3_reset_notify_uninit_enet
 	hns3_put_ring_config(priv);
 	priv->ring_data = NULL;
 
-	clear_bit(HNS3_NIC_STATE_INITED, &priv->state);
-
 	return ret;
 }