mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-14 14:46:42 +07:00
drivers: net: xgene: Fix error handling
When probe bails out with an error, we try to unregister the netdev before we have even registered it. Fix the goto statements for that. Signed-off-by: Matthias Brugger <mbrugger@suse.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7391daf2ff
commit
20decb7e48
@ -1595,21 +1595,22 @@ static int xgene_enet_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
ret = xgene_enet_init_hw(pdata);
|
ret = xgene_enet_init_hw(pdata);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err;
|
goto err_netdev;
|
||||||
|
|
||||||
mac_ops = pdata->mac_ops;
|
mac_ops = pdata->mac_ops;
|
||||||
if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) {
|
if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) {
|
||||||
ret = xgene_enet_mdio_config(pdata);
|
ret = xgene_enet_mdio_config(pdata);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err;
|
goto err_netdev;
|
||||||
} else {
|
} else {
|
||||||
INIT_DELAYED_WORK(&pdata->link_work, mac_ops->link_state);
|
INIT_DELAYED_WORK(&pdata->link_work, mac_ops->link_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
xgene_enet_napi_add(pdata);
|
xgene_enet_napi_add(pdata);
|
||||||
return 0;
|
return 0;
|
||||||
err:
|
err_netdev:
|
||||||
unregister_netdev(ndev);
|
unregister_netdev(ndev);
|
||||||
|
err:
|
||||||
free_netdev(ndev);
|
free_netdev(ndev);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user