summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorMatthias Brugger <mbrugger@suse.com>2016-05-03 16:05:07 +0200
committerDavid S. Miller <davem@davemloft.net>2016-05-04 14:00:44 -0400
commit20decb7e486d7eefff3931f58d092d2d7c024a1c (patch)
tree0e9a8948d66215575953b65b0c934ddeb5159054 /drivers/net
parent7391daf2ffc780679d6ab3fad1db2619e5dd2c2a (diff)
downloadblackbird-op-linux-20decb7e486d7eefff3931f58d092d2d7c024a1c.tar.gz
blackbird-op-linux-20decb7e486d7eefff3931f58d092d2d7c024a1c.zip
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>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/apm/xgene/xgene_enet_main.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 8d4c1ad2fc60..99d7e580e166 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -1595,21 +1595,22 @@ static int xgene_enet_probe(struct platform_device *pdev)
ret = xgene_enet_init_hw(pdata);
if (ret)
- goto err;
+ goto err_netdev;
mac_ops = pdata->mac_ops;
if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) {
ret = xgene_enet_mdio_config(pdata);
if (ret)
- goto err;
+ goto err_netdev;
} else {
INIT_DELAYED_WORK(&pdata->link_work, mac_ops->link_state);
}
xgene_enet_napi_add(pdata);
return 0;
-err:
+err_netdev:
unregister_netdev(ndev);
+err:
free_netdev(ndev);
return ret;
}
OpenPOWER on IntegriCloud