]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
drivers/regulator: fix when type is different from REGULATOR_VOLTAGE or REGULATOR_CURRENT
authorDiego Liziero <diegoliz@gmail.com>
Tue, 14 Apr 2009 01:04:47 +0000 (03:04 +0200)
committerLiam Girdwood <lrg@slimlogic.co.uk>
Tue, 28 Apr 2009 17:58:07 +0000 (18:58 +0100)
When regulator_desc->type is something different from REGULATOR_VOLTAGE or REGULATOR_CURRENT
the if should probably return ERR_PTR(-EINVAL)

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

@@ expression E; constant C; @@
(
- !E == C
+ E != C
)

Signed-off-by: Diego Liziero <diegoliz@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
drivers/regulator/core.c

index 47fc6e6fe9bc269dfb911f46e6c640026f5dd06c..cb62be63caed1b1729fb41825e2f069a1ab0e211 100644 (file)
@@ -2001,8 +2001,8 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
        if (regulator_desc->name == NULL || regulator_desc->ops == NULL)
                return ERR_PTR(-EINVAL);
 
-       if (!regulator_desc->type == REGULATOR_VOLTAGE &&
-           !regulator_desc->type == REGULATOR_CURRENT)
+       if (regulator_desc->type != REGULATOR_VOLTAGE &&
+           regulator_desc->type != REGULATOR_CURRENT)
                return ERR_PTR(-EINVAL);
 
        if (!init_data)