regulator: ab8500-ext: Don't update info->is_enabled if write to register fails

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
Axel Lin 2013-04-02 20:56:16 +08:00 committed by Mark Brown
parent 1ec990c002
commit 37daa8aed1
1 changed files with 6 additions and 2 deletions

View File

@ -72,9 +72,11 @@ static int enable(struct ab8500_ext_regulator_info *info, u8 *regval)
ret = abx500_mask_and_set_register_interruptible(info->dev,
info->update_bank, info->update_reg,
info->update_mask, *regval);
if (ret < 0)
if (ret < 0) {
dev_err(rdev_get_dev(info->rdev),
"couldn't set enable bits for regulator\n");
return ret;
}
info->is_enabled = true;
@ -117,9 +119,11 @@ static int disable(struct ab8500_ext_regulator_info *info, u8 *regval)
ret = abx500_mask_and_set_register_interruptible(info->dev,
info->update_bank, info->update_reg,
info->update_mask, *regval);
if (ret < 0)
if (ret < 0) {
dev_err(rdev_get_dev(info->rdev),
"couldn't set disable bits for regulator\n");
return ret;
}
info->is_enabled = false;