[PATCH 1/3] drivers/power/pda_power.c: Move call to PTR_ERR after reassignment

From: Julia Lawall
Date: Thu Feb 02 2012 - 09:01:09 EST

From: Julia Lawall <julia@xxxxxxx>

Delete successive assignments to the same location.

The semantic match that finds this problem is as follows:

// <smpl>
expression e,e1;
constant c;

*e = c
... when != e = e1
when != &e
when != true IS_ERR(e)
// </smpl>

Signed-off-by: Julia Lawall <julia@xxxxxxx>
Reported-by: Josh Triplett <josh@xxxxxxxxxxxxxxxx>

This patch probably only half way solves the problem with this code. It would
seem that it should have a goto at the end, but I am not sure to where.

drivers/power/pda_power.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c
index fd49689..16611c3 100644
--- a/drivers/power/pda_power.c
+++ b/drivers/power/pda_power.c
@@ -316,8 +316,8 @@ static int pda_power_probe(struct platform_device *pdev)
ac_draw = regulator_get(dev, "ac_draw");
if (IS_ERR(ac_draw)) {
dev_dbg(dev, "couldn't get ac_draw regulator\n");
- ac_draw = NULL;
ret = PTR_ERR(ac_draw);
+ ac_draw = NULL;


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/