Skip to content

Commit

Permalink
fec: Fix fec_enet_alloc_buffers() error path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Fabio Estevam authored and David S. Miller committed Oct 6, 2014
1 parent b3a00c9 commit 681d242
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions drivers/net/ethernet/freescale/fec_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2747,23 +2747,26 @@ 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);
phy_start(fep->phy_dev);
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
Expand Down

0 comments on commit 681d242

Please sign in to comment.