Skip to content

Commit

Permalink
regulator: ab8500: Don't update is_enabled flag in error paths
Browse files Browse the repository at this point in the history
This avoid setting is_enabled flag to wrong status if enable/disable 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>
  • Loading branch information
Axel Lin authored and Mark Brown committed Mar 26, 2013
1 parent 5689e83 commit f71bf52
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/regulator/ab8500.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,11 @@ static int ab8500_regulator_enable(struct regulator_dev *rdev)
ret = abx500_mask_and_set_register_interruptible(info->dev,
info->update_bank, info->update_reg,
info->update_mask, info->update_val);
if (ret < 0)
if (ret < 0) {
dev_err(rdev_get_dev(rdev),
"couldn't set enable bits for regulator\n");
return ret;
}

info->is_enabled = true;

Expand All @@ -144,9 +146,11 @@ static int ab8500_regulator_disable(struct regulator_dev *rdev)
ret = abx500_mask_and_set_register_interruptible(info->dev,
info->update_bank, info->update_reg,
info->update_mask, 0x0);
if (ret < 0)
if (ret < 0) {
dev_err(rdev_get_dev(rdev),
"couldn't set disable bits for regulator\n");
return ret;
}

info->is_enabled = false;

Expand Down

0 comments on commit f71bf52

Please sign in to comment.