Skip to content

Commit

Permalink
fec: Disable the PHY regulator on error and removal
Browse files Browse the repository at this point in the history
In the case of error during probe, disable the PHY regulator.

Do the same in fec_drv_remove().

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 May 28, 2013
1 parent 7a2bbd8 commit f6a4d60
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/net/ethernet/freescale/fec_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1926,6 +1926,8 @@ fec_probe(struct platform_device *pdev)
"Failed to enable phy regulator: %d\n", ret);
goto failed_regulator;
}
} else {
fep->reg_phy = NULL;
}

fec_reset_phy(pdev);
Expand Down Expand Up @@ -1982,6 +1984,8 @@ fec_probe(struct platform_device *pdev)
free_irq(irq, ndev);
}
failed_init:
if (fep->reg_phy)
regulator_disable(fep->reg_phy);
failed_regulator:
clk_disable_unprepare(fep->clk_ahb);
clk_disable_unprepare(fep->clk_ipg);
Expand All @@ -2005,6 +2009,8 @@ fec_drv_remove(struct platform_device *pdev)
unregister_netdev(ndev);
fec_enet_mii_remove(fep);
del_timer_sync(&fep->time_keep);
if (fep->reg_phy)
regulator_disable(fep->reg_phy);
clk_disable_unprepare(fep->clk_ptp);
if (fep->ptp_clock)
ptp_clock_unregister(fep->ptp_clock);
Expand Down

0 comments on commit f6a4d60

Please sign in to comment.