Skip to content

Commit 20decb7

Browse files
mbggdavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7391daf commit 20decb7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/net/ethernet/apm/xgene/xgene_enet_main.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,21 +1595,22 @@ static int xgene_enet_probe(struct platform_device *pdev)
15951595

15961596
ret = xgene_enet_init_hw(pdata);
15971597
if (ret)
1598-
goto err;
1598+
goto err_netdev;
15991599

16001600
mac_ops = pdata->mac_ops;
16011601
if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) {
16021602
ret = xgene_enet_mdio_config(pdata);
16031603
if (ret)
1604-
goto err;
1604+
goto err_netdev;
16051605
} else {
16061606
INIT_DELAYED_WORK(&pdata->link_work, mac_ops->link_state);
16071607
}
16081608

16091609
xgene_enet_napi_add(pdata);
16101610
return 0;
1611-
err:
1611+
err_netdev:
16121612
unregister_netdev(ndev);
1613+
err:
16131614
free_netdev(ndev);
16141615
return ret;
16151616
}

0 commit comments

Comments
 (0)