summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2013-04-02 16:56:16 +0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-04-03 02:05:39 +0400
commit37daa8aed1af2e09abfdb66e8da9074eb9b9e1a1 (patch)
tree09e5fd23c4e541be8524975d4d220e686e916f14
parent1ec990c0020496ad32bf35726f7c033d09c2fce7 (diff)
downloadlinux-37daa8aed1af2e09abfdb66e8da9074eb9b9e1a1.tar.xz
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>
-rw-r--r--drivers/regulator/ab8500-ext.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/regulator/ab8500-ext.c b/drivers/regulator/ab8500-ext.c
index c24372e96922..57d43a10e6b0 100644
--- a/drivers/regulator/ab8500-ext.c
+++ b/drivers/regulator/ab8500-ext.c
@@ -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;