diff options
author | Alexey Khoroshilov <khoroshilov@ispras.ru> | 2018-02-22 22:40:11 +0100 |
---|---|---|
committer | Kishon Vijay Abraham I <kishon@ti.com> | 2018-03-16 09:10:42 +0100 |
commit | 124380cb0e7a5fb704a81d135e5b7b4904c1ef95 (patch) | |
tree | b4c1baae331a729238129c99ce53f379be0f145e /drivers/phy/phy-lpc18xx-usb-otg.c | |
parent | phy: allwinner: sun4i-usb: poll vbus changes on A23/A33 when driving VBUS (diff) | |
download | linux-124380cb0e7a5fb704a81d135e5b7b4904c1ef95.tar.xz linux-124380cb0e7a5fb704a81d135e5b7b4904c1ef95.zip |
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 <khoroshilov@ispras.ru>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers/phy/phy-lpc18xx-usb-otg.c')
-rw-r--r-- | drivers/phy/phy-lpc18xx-usb-otg.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/phy/phy-lpc18xx-usb-otg.c b/drivers/phy/phy-lpc18xx-usb-otg.c index 3b7a71eb5b7e..7de280a45421 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) |