]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
drivers/regulator: use PTR_ERR to get error code
authorJulia Lawall <julia@diku.dk>
Sat, 21 Nov 2009 21:18:44 +0000 (22:18 +0100)
committerLiam Girdwood <lrg@slimlogic.co.uk>
Thu, 17 Dec 2009 10:27:27 +0000 (10:27 +0000)
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>
drivers/regulator/lp3971.c

index 7803a320543b1da4f9da2d64ed33e0f108b2f634..76d08c282f9cac3a54133acc30b88fda81b37738 100644 (file)
@@ -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;