summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@freescale.com>2014-10-04 20:40:01 +0400
committerDavid S. Miller <davem@davemloft.net>2014-10-06 08:53:56 +0400
commit681d2421e1135b95f5cd9d16fe10eac7f570a9f2 (patch)
tree69a50affab4bd3624ad3818d8093e8ef518202bf
parentb3a00c912cdf8efe985a08018fe26f362b32c1ac (diff)
downloadlinux-681d2421e1135b95f5cd9d16fe10eac7f570a9f2.tar.xz
fec: Fix fec_enet_alloc_buffers() error path
When fec_enet_alloc_buffers() fails we should better undo the previous actions, which consists of: disabling the FEC clocks and putting the FEC pins into inactive state. The error path for fec_enet_mii_probe() is kept unchanged. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index e190eb0ed006..87975b5dda94 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -2747,16 +2747,12 @@ fec_enet_open(struct net_device *ndev)
ret = fec_enet_alloc_buffers(ndev);
if (ret)
- return ret;
+ goto err_enet_alloc;
/* Probe and connect to PHY when open the interface */
ret = fec_enet_mii_probe(ndev);
- if (ret) {
- fec_enet_free_buffers(ndev);
- fec_enet_clk_enable(ndev, false);
- pinctrl_pm_select_sleep_state(&fep->pdev->dev);
- return ret;
- }
+ if (ret)
+ goto err_enet_mii_probe;
fec_restart(ndev);
napi_enable(&fep->napi);
@@ -2764,6 +2760,13 @@ fec_enet_open(struct net_device *ndev)
netif_tx_start_all_queues(ndev);
return 0;
+
+err_enet_mii_probe:
+ fec_enet_free_buffers(ndev);
+err_enet_alloc:
+ fec_enet_clk_enable(ndev, false);
+ pinctrl_pm_select_sleep_state(&fep->pdev->dev);
+ return ret;
}
static int