From: Fabio Estevam Date: Mon, 27 May 2013 03:48:31 +0000 (+0000) Subject: fec: Disable the PHY regulator on error and removal X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e03cf139068d9fa66b57d4ec65a3f6971cf0bf6d;p=karo-tx-linux.git fec: Disable the PHY regulator on error and removal In the case of error during probe, disable the PHY regulator. Do the same in fec_drv_remove(). Signed-off-by: Fabio Estevam Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 4958a9bc43a6..2921bf9b3501 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -1952,6 +1952,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); @@ -2008,6 +2010,8 @@ failed_irq: 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); @@ -2031,6 +2035,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);