From 7dc9344963b2d81f692dd0a704fe30d5eeffdcff Mon Sep 17 00:00:00 2001 From: Anirudh Ghayal Date: Sun, 27 Dec 2015 12:39:32 +0530 Subject: 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 --- drivers/regulator/msm_gfx_ldo.c | 8 +++++--- 1 file 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; -- cgit v1.2.3