Skip to content

Commit

Permalink
net: hns3: clear inited state and stop client after failed to registe…
Browse files Browse the repository at this point in the history
…r netdev

[ Upstream commit e98365a ]

If failed to register netdev, it needs to clear INITED state and stop
client in case of cause problem when concurrency with uninitialized
process of driver.

Fixes: a289a7e ("net: hns3: put off calling register_netdev() until client initialize complete")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
IronShen authored and gregkh committed May 9, 2022
1 parent 3272a75 commit de00296
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
Expand Up @@ -5132,6 +5132,13 @@ static void hns3_state_init(struct hnae3_handle *handle)
set_bit(HNS3_NIC_STATE_RXD_ADV_LAYOUT_ENABLE, &priv->state);
}

static void hns3_state_uninit(struct hnae3_handle *handle)
{
struct hns3_nic_priv *priv = handle->priv;

clear_bit(HNS3_NIC_STATE_INITED, &priv->state);
}

static int hns3_client_init(struct hnae3_handle *handle)
{
struct pci_dev *pdev = handle->pdev;
Expand Down Expand Up @@ -5249,7 +5256,9 @@ static int hns3_client_init(struct hnae3_handle *handle)
return ret;

out_reg_netdev_fail:
hns3_state_uninit(handle);
hns3_dbg_uninit(handle);
hns3_client_stop(handle);
out_client_start:
hns3_free_rx_cpu_rmap(netdev);
hns3_nic_uninit_irq(priv);
Expand Down

0 comments on commit de00296

Please sign in to comment.