Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

phy: samsung_usb2: Fixup samsung_usb2_phy_power_on/off paths

Ensure we have balanced clk_prepare_enable/clk_disable_unprepare calls if
.power_on or .power_off callbacks return error.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

authored by

Axel Lin and committed by
Kishon Vijay Abraham I
7a504c93 2be60856

+8 -2
+8 -2
drivers/phy/phy-samsung-usb2.c
··· 37 37 spin_lock(&drv->lock); 38 38 ret = inst->cfg->power_on(inst); 39 39 spin_unlock(&drv->lock); 40 + if (ret) 41 + goto err_power_on; 40 42 } 41 43 42 44 return 0; 43 45 46 + err_power_on: 47 + clk_disable_unprepare(drv->ref_clk); 44 48 err_instance_clk: 45 49 clk_disable_unprepare(drv->clk); 46 50 err_main_clk: ··· 55 51 { 56 52 struct samsung_usb2_phy_instance *inst = phy_get_drvdata(phy); 57 53 struct samsung_usb2_phy_driver *drv = inst->drv; 58 - int ret = 0; 54 + int ret; 59 55 60 56 dev_dbg(drv->dev, "Request to power_off \"%s\" usb phy\n", 61 57 inst->cfg->label); ··· 63 59 spin_lock(&drv->lock); 64 60 ret = inst->cfg->power_off(inst); 65 61 spin_unlock(&drv->lock); 62 + if (ret) 63 + return ret; 66 64 } 67 65 clk_disable_unprepare(drv->ref_clk); 68 66 clk_disable_unprepare(drv->clk); 69 - return ret; 67 + return 0; 70 68 } 71 69 72 70 static struct phy_ops samsung_usb2_phy_ops = {