mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-18 18:23:53 +08:00
regulator: qcom_rpm: Don't update vreg->uV/mV if rpm_reg_write fails
Ensure get_voltage return correct voltage if set_voltage fails. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
97bf6af1f9
commit
c6515d2f00
@ -227,9 +227,11 @@ static int rpm_reg_set_mV_sel(struct regulator_dev *rdev,
|
|||||||
return uV;
|
return uV;
|
||||||
|
|
||||||
mutex_lock(&vreg->lock);
|
mutex_lock(&vreg->lock);
|
||||||
vreg->uV = uV;
|
|
||||||
if (vreg->is_enabled)
|
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);
|
mutex_unlock(&vreg->lock);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -252,9 +254,11 @@ static int rpm_reg_set_uV_sel(struct regulator_dev *rdev,
|
|||||||
return uV;
|
return uV;
|
||||||
|
|
||||||
mutex_lock(&vreg->lock);
|
mutex_lock(&vreg->lock);
|
||||||
vreg->uV = uV;
|
|
||||||
if (vreg->is_enabled)
|
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);
|
mutex_unlock(&vreg->lock);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user