From: Alexey Khoroshilov Date: Thu, 22 Feb 2018 21:40:11 +0000 (+0300) Subject: phy: lpc18xx-usb-otg: error handling in lpc18xx_usb_otg_phy_power_on() X-Git-Tag: v4.19~1304^2~42^2~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=124380cb0e7a5fb704a81d135e5b7b4904c1ef95;p=platform%2Fkernel%2Flinux-rpi.git phy: lpc18xx-usb-otg: error handling in lpc18xx_usb_otg_phy_power_on() If regmap_update_bits() fails in lpc18xx_usb_otg_phy_power_on(), lpc->clk is left enabled. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov Signed-off-by: Kishon Vijay Abraham I --- diff --git a/drivers/phy/phy-lpc18xx-usb-otg.c b/drivers/phy/phy-lpc18xx-usb-otg.c index 3b7a71e..7de280a 100644 --- a/drivers/phy/phy-lpc18xx-usb-otg.c +++ b/drivers/phy/phy-lpc18xx-usb-otg.c @@ -60,8 +60,14 @@ static int lpc18xx_usb_otg_phy_power_on(struct phy *phy) return ret; /* The bit in CREG is cleared to enable the PHY */ - return regmap_update_bits(lpc->reg, LPC18XX_CREG_CREG0, + ret = regmap_update_bits(lpc->reg, LPC18XX_CREG_CREG0, LPC18XX_CREG_CREG0_USB0PHY, 0); + if (ret) { + clk_disable(lpc->clk); + return ret; + } + + return 0; } static int lpc18xx_usb_otg_phy_power_off(struct phy *phy)