From: Diego Liziero Date: Tue, 14 Apr 2009 01:04:47 +0000 (+0200) Subject: drivers/regulator: fix when type is different from REGULATOR_VOLTAGE or REGULATOR_CURRENT X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cd78dfc6c6e321a310a73ef7b0df3d262704dd55;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git drivers/regulator: fix when type is different from REGULATOR_VOLTAGE or REGULATOR_CURRENT 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 Acked-by: Mark Brown Signed-off-by: Liam Girdwood --- diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 47fc6e6fe9bc..cb62be63caed 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -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)