mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
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>
This commit is contained in:
parent
2be608561a
commit
7a504c935e
1 changed files with 8 additions and 2 deletions
|
@ -37,10 +37,14 @@ static int samsung_usb2_phy_power_on(struct phy *phy)
|
||||||
spin_lock(&drv->lock);
|
spin_lock(&drv->lock);
|
||||||
ret = inst->cfg->power_on(inst);
|
ret = inst->cfg->power_on(inst);
|
||||||
spin_unlock(&drv->lock);
|
spin_unlock(&drv->lock);
|
||||||
|
if (ret)
|
||||||
|
goto err_power_on;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err_power_on:
|
||||||
|
clk_disable_unprepare(drv->ref_clk);
|
||||||
err_instance_clk:
|
err_instance_clk:
|
||||||
clk_disable_unprepare(drv->clk);
|
clk_disable_unprepare(drv->clk);
|
||||||
err_main_clk:
|
err_main_clk:
|
||||||
|
@ -51,7 +55,7 @@ static int samsung_usb2_phy_power_off(struct phy *phy)
|
||||||
{
|
{
|
||||||
struct samsung_usb2_phy_instance *inst = phy_get_drvdata(phy);
|
struct samsung_usb2_phy_instance *inst = phy_get_drvdata(phy);
|
||||||
struct samsung_usb2_phy_driver *drv = inst->drv;
|
struct samsung_usb2_phy_driver *drv = inst->drv;
|
||||||
int ret = 0;
|
int ret;
|
||||||
|
|
||||||
dev_dbg(drv->dev, "Request to power_off \"%s\" usb phy\n",
|
dev_dbg(drv->dev, "Request to power_off \"%s\" usb phy\n",
|
||||||
inst->cfg->label);
|
inst->cfg->label);
|
||||||
|
@ -59,10 +63,12 @@ static int samsung_usb2_phy_power_off(struct phy *phy)
|
||||||
spin_lock(&drv->lock);
|
spin_lock(&drv->lock);
|
||||||
ret = inst->cfg->power_off(inst);
|
ret = inst->cfg->power_off(inst);
|
||||||
spin_unlock(&drv->lock);
|
spin_unlock(&drv->lock);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
clk_disable_unprepare(drv->ref_clk);
|
clk_disable_unprepare(drv->ref_clk);
|
||||||
clk_disable_unprepare(drv->clk);
|
clk_disable_unprepare(drv->clk);
|
||||||
return ret;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct phy_ops samsung_usb2_phy_ops = {
|
static struct phy_ops samsung_usb2_phy_ops = {
|
||||||
|
|
Loading…
Reference in a new issue