From: Axel Lin Date: Tue, 17 Mar 2015 00:39:01 +0000 (+0800) Subject: phy: stih41x-usb: Fixup stih41x_usb_phy_power_on failure path X-Git-Tag: firefly_0821_release~176^2~2000^2~3^2~11 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=080de5ba390c54b7504c43b36ae21911acf66b30;p=firefly-linux-kernel-4.4.55.git phy: stih41x-usb: Fixup stih41x_usb_phy_power_on failure path If stih41x_usb_phy_power_on() fails, we need to call clk_disable_unprepare() before return error. This is to ensure we have balanced clk_enable/disable calls. Signed-off-by: Axel Lin Acked-by: Patrice Chotard Signed-off-by: Kishon Vijay Abraham I --- diff --git a/drivers/phy/phy-stih41x-usb.c b/drivers/phy/phy-stih41x-usb.c index a603801293ff..c093b472b57d 100644 --- a/drivers/phy/phy-stih41x-usb.c +++ b/drivers/phy/phy-stih41x-usb.c @@ -87,8 +87,12 @@ static int stih41x_usb_phy_power_on(struct phy *phy) return ret; } - return regmap_update_bits(phy_dev->regmap, phy_dev->cfg->syscfg, - phy_dev->cfg->oscok, phy_dev->cfg->oscok); + ret = regmap_update_bits(phy_dev->regmap, phy_dev->cfg->syscfg, + phy_dev->cfg->oscok, phy_dev->cfg->oscok); + if (ret) + clk_disable_unprepare(phy_dev->clk); + + return ret; } static int stih41x_usb_phy_power_off(struct phy *phy)