diff options
author | Axel Lin <axel.lin@ingics.com> | 2015-03-16 20:42:38 -0400 |
---|---|---|
committer | Kishon Vijay Abraham I <kishon@ti.com> | 2015-03-25 19:36:10 -0400 |
commit | 7a504c935e42737e5ad40ea2f6f2d21b4dc27e81 (patch) | |
tree | d678f93bce11774a3468d055718a5853f41583c0 /drivers/phy | |
parent | 2be608561abfcceda4b35b71a0c1ec5088bb39b9 (diff) |
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>
Diffstat (limited to 'drivers/phy')
-rw-r--r-- | drivers/phy/phy-samsung-usb2.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/phy/phy-samsung-usb2.c b/drivers/phy/phy-samsung-usb2.c index 4a12f66b7fb5..55b6994932e3 100644 --- a/drivers/phy/phy-samsung-usb2.c +++ b/drivers/phy/phy-samsung-usb2.c | |||
@@ -37,10 +37,14 @@ static int samsung_usb2_phy_power_on(struct phy *phy) | |||
37 | spin_lock(&drv->lock); | 37 | spin_lock(&drv->lock); |
38 | ret = inst->cfg->power_on(inst); | 38 | ret = inst->cfg->power_on(inst); |
39 | spin_unlock(&drv->lock); | 39 | spin_unlock(&drv->lock); |
40 | if (ret) | ||
41 | goto err_power_on; | ||
40 | } | 42 | } |
41 | 43 | ||
42 | return 0; | 44 | return 0; |
43 | 45 | ||
46 | err_power_on: | ||
47 | clk_disable_unprepare(drv->ref_clk); | ||
44 | err_instance_clk: | 48 | err_instance_clk: |
45 | clk_disable_unprepare(drv->clk); | 49 | clk_disable_unprepare(drv->clk); |
46 | err_main_clk: | 50 | err_main_clk: |
@@ -51,7 +55,7 @@ static int samsung_usb2_phy_power_off(struct phy *phy) | |||
51 | { | 55 | { |
52 | struct samsung_usb2_phy_instance *inst = phy_get_drvdata(phy); | 56 | struct samsung_usb2_phy_instance *inst = phy_get_drvdata(phy); |
53 | struct samsung_usb2_phy_driver *drv = inst->drv; | 57 | struct samsung_usb2_phy_driver *drv = inst->drv; |
54 | int ret = 0; | 58 | int ret; |
55 | 59 | ||
56 | dev_dbg(drv->dev, "Request to power_off \"%s\" usb phy\n", | 60 | dev_dbg(drv->dev, "Request to power_off \"%s\" usb phy\n", |
57 | inst->cfg->label); | 61 | inst->cfg->label); |
@@ -59,10 +63,12 @@ static int samsung_usb2_phy_power_off(struct phy *phy) | |||
59 | spin_lock(&drv->lock); | 63 | spin_lock(&drv->lock); |
60 | ret = inst->cfg->power_off(inst); | 64 | ret = inst->cfg->power_off(inst); |
61 | spin_unlock(&drv->lock); | 65 | spin_unlock(&drv->lock); |
66 | if (ret) | ||
67 | return ret; | ||
62 | } | 68 | } |
63 | clk_disable_unprepare(drv->ref_clk); | 69 | clk_disable_unprepare(drv->ref_clk); |
64 | clk_disable_unprepare(drv->clk); | 70 | clk_disable_unprepare(drv->clk); |
65 | return ret; | 71 | return 0; |
66 | } | 72 | } |
67 | 73 | ||
68 | static struct phy_ops samsung_usb2_phy_ops = { | 74 | static struct phy_ops samsung_usb2_phy_ops = { |