aboutsummaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2010-08-14 21:44:04 +0800
committerMian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>2010-10-04 17:59:02 +0200
commit1d9cc63045303a87b8ea515146be6536ad64ad6a (patch)
treec7233ccd575513037c2bff004f6aefb5a516ae31 /drivers/regulator
parent66709fa52c386d6705af56dcb1ce8ace67ae0a5c (diff)
regulator: ab8500 - fix the logic to remove already registered regulators in error path
In current implementation, ab8500_regulator_info[0].regulator is not unregistered if the error happen at i > 0. This patch fixes the resource leak and also improves the readability. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Linus Walleij <linus.walleij@stericsson.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/ab8500.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index dc3f1a49167..775688e0b1c 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -368,11 +368,9 @@ static __devinit int ab8500_regulator_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "failed to register regulator %s\n",
info->desc.name);
/* when we fail, un-register all earlier regulators */
- i--;
- while (i > 0) {
+ while (--i >= 0) {
info = &ab8500_regulator_info[i];
regulator_unregister(info->regulator);
- i--;
}
return err;
}