From: Axel Lin Date: Tue, 2 Apr 2013 12:56:16 +0000 (+0800) Subject: regulator: ab8500-ext: Don't update info->is_enabled if write to register fails X-Git-Tag: firefly_0821_release~3680^2~668^2~25^2~27 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=37daa8aed1af2e09abfdb66e8da9074eb9b9e1a1;p=firefly-linux-kernel-4.4.55.git regulator: ab8500-ext: Don't update info->is_enabled if write to register fails Signed-off-by: Axel Lin Acked-by: Bengt Jonsson Signed-off-by: Mark Brown --- 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;