summaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2009-11-21 22:18:44 +0100
committerLiam Girdwood <lrg@slimlogic.co.uk>2009-12-17 10:27:27 +0000
commitd662fc82dc745ee24d518b0fde5a6a19758092ec (patch)
treec0cb7b58cafe6c162c881c75c966b0aa814c2e4d /drivers/regulator
parentb56daf13eb77ee24f48f0bb34c2492f46a432ec4 (diff)
drivers/regulator: use PTR_ERR to get error code
IS_ERR returns only 1 or 0. The callsite of setup_regulators expects a negative integer in an error case. Thus, PTR_ERR has to be used to extract it. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression E,E1; @@ *E = IS_ERR(...) ... when != E = E1 *return E; // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Acked-by: <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/lp3971.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/regulator/lp3971.c b/drivers/regulator/lp3971.c
index 7803a320543..76d08c282f9 100644
--- a/drivers/regulator/lp3971.c
+++ b/drivers/regulator/lp3971.c
@@ -446,8 +446,8 @@ static int setup_regulators(struct lp3971 *lp3971,
lp3971->rdev[i] = regulator_register(&regulators[id],
lp3971->dev, pdata->regulators[i].initdata, lp3971);
- err = IS_ERR(lp3971->rdev[i]);
- if (err) {
+ if (IS_ERR(lp3971->rdev[i])) {
+ err = PTR_ERR(lp3971->rdev[i]);
dev_err(lp3971->dev, "regulator init failed: %d\n",
err);
goto error;