summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnirudh Ghayal <aghayal@codeaurora.org>2015-12-27 12:39:32 +0530
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 21:16:16 -0700
commit7dc9344963b2d81f692dd0a704fe30d5eeffdcff (patch)
tree48e480f63eda72eb59d008355feadb86af63b962
parenta5a0b5e480d80b5c069d216aefcf3e741a466dfa (diff)
regulator: msm-gfx-ldo: Disable CX only in the error path
Disable the regulator vote on CX only if there is failure, also check if the regulator handle is valid. Change-Id: I8cbb8aad3c99d0a619dfeb2f68873c39316f0158 Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
-rw-r--r--drivers/regulator/msm_gfx_ldo.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/regulator/msm_gfx_ldo.c b/drivers/regulator/msm_gfx_ldo.c
index 9e25b6ba3d6a..35e370ed52af 100644
--- a/drivers/regulator/msm_gfx_ldo.c
+++ b/drivers/regulator/msm_gfx_ldo.c
@@ -365,9 +365,11 @@ static int msm_gfx_ldo_enable(struct regulator_dev *rdev)
ldo_vreg->vreg_enabled = true;
disable_cx:
- rc = regulator_disable(ldo_vreg->vdd_cx);
- if (rc)
- pr_err("regulator_enable: vdd_cx: failed rc=%d\n", rc);
+ if (rc && ldo_vreg->vdd_cx) {
+ rc = regulator_disable(ldo_vreg->vdd_cx);
+ if (rc)
+ pr_err("regulator_enable: vdd_cx: failed rc=%d\n", rc);
+ }
fail:
mutex_unlock(&ldo_vreg->ldo_mutex);
return rc;