Skip to contentSkip to conversation

drivers/regulator: fix when type is different from REGULATOR_VOLTAGE

PATCH Applied Diego Liziero 3 participants 3 messages Apr 14, 2009 – Apr 15, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/regulator: fix when type is different from REGULATOR_VOLTAGE

From: Diego Liziero <[email protected]>

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
)

---

tmp/cocci-output-26453-5bbb39-core.c renamed from drivers/regulator/core.c +2 -2
diff = 
@@ -2001,8 +2001,8 @@ struct regulator_dev *regulator_register
 	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)
#2 lore raw

Re: [PATCH] drivers/regulator: fix when type is different from

In reply to Diego Liziero
Quoted 8 lines · Diego Liziero

From: Diego Liziero <[email protected]>

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/)

Quoted 8 lines

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

Applied.

Thanks

Liam