Commit 681d2421 authored by Fabio Estevam's avatar Fabio Estevam Committed by David S. Miller

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: default avatarFabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b3a00c91
...@@ -2747,16 +2747,12 @@ fec_enet_open(struct net_device *ndev) ...@@ -2747,16 +2747,12 @@ fec_enet_open(struct net_device *ndev)
ret = fec_enet_alloc_buffers(ndev); ret = fec_enet_alloc_buffers(ndev);
if (ret) if (ret)
return ret; goto err_enet_alloc;
/* Probe and connect to PHY when open the interface */ /* Probe and connect to PHY when open the interface */
ret = fec_enet_mii_probe(ndev); ret = fec_enet_mii_probe(ndev);
if (ret) { if (ret)
fec_enet_free_buffers(ndev); goto err_enet_mii_probe;
fec_enet_clk_enable(ndev, false);
pinctrl_pm_select_sleep_state(&fep->pdev->dev);
return ret;
}
fec_restart(ndev); fec_restart(ndev);
napi_enable(&fep->napi); napi_enable(&fep->napi);
...@@ -2764,6 +2760,13 @@ fec_enet_open(struct net_device *ndev) ...@@ -2764,6 +2760,13 @@ fec_enet_open(struct net_device *ndev)
netif_tx_start_all_queues(ndev); netif_tx_start_all_queues(ndev);
return 0; 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 static int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment