Skip to contentSkip to conversation

regulator: qcom_rpm: Don't update vreg->uV/mV if rpm_reg_write fails

PATCH Applied Axel Lin 2 participants 2 messages Jan 24, 2015 – Jan 26, 2015

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 regulator: qcom_rpm: Don't update vreg->uV/mV if rpm_reg_write fails

Ensure get_voltage return correct voltage if set_voltage fails.

---
 drivers/regulator/qcom_rpm-regulator.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/regulator/qcom_rpm-regulator.c +8 -4
index edd0a17..f48b3de 100644
@@ -228,9 +228,11 @@ static int rpm_reg_set_mV_sel(struct regulator_dev *rdev,
 		return uV;
 
 	mutex_lock(&vreg->lock);
-	vreg->uV = uV;
 	if (vreg->is_enabled)
-		ret = rpm_reg_write(vreg, req, vreg->uV / 1000);
+		ret = rpm_reg_write(vreg, req, uV / 1000);
+
+	if (!ret)
+		vreg->uV = uV;
 	mutex_unlock(&vreg->lock);
 
 	return ret;
@@ -253,9 +255,11 @@ static int rpm_reg_set_uV_sel(struct regulator_dev *rdev,
 		return uV;
 
 	mutex_lock(&vreg->lock);
-	vreg->uV = uV;
 	if (vreg->is_enabled)
-		ret = rpm_reg_write(vreg, req, vreg->uV);
+		ret = rpm_reg_write(vreg, req, uV);
+
+	if (!ret)
+		vreg->uV = uV;
 	mutex_unlock(&vreg->lock);
 
 	return ret;
Signature · 1 line
1.9.1
maintainer Applied
#1 lore raw
Quoted 1 line · Axel Lin

Ensure get_voltage return correct voltage if set_voltage fails.

Applied, thanks.