From: Julia Lawall <Julia.Lawall@lip6.fr>
To: linux-kernel@vger.kernel.org, josh@joshtriplett.org
Cc: kernel-janitors@vger.kernel.org, Julia Lawall <julia@diku.dk>
Subject: [PATCH 1/3] drivers/power/pda_power.c: Move call to PTR_ERR after reassignment
Date: Thu, 2 Feb 2012 15:00:45 +0100 [thread overview]
Message-ID: <1328191247-23792-2-git-send-email-Julia.Lawall@lip6.fr> (raw)
In-Reply-To: <1328191247-23792-1-git-send-email-Julia.Lawall@lip6.fr>
From: Julia Lawall <julia@diku.dk>
Delete successive assignments to the same location.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression e,e1;
constant c;
@@
*e = c
... when != e = e1
when != &e
when != true IS_ERR(e)
*PTR_ERR(e)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Reported-by: Josh Triplett <josh@joshtriplett.org>
---
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;
}
#ifdef CONFIG_USB_OTG_UTILS
next prev parent reply other threads:[~2012-02-02 14:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-02 14:00 [PATCH 0/3] Move call to PTR_ERR after reassignment Julia Lawall
2012-02-02 14:00 ` Julia Lawall [this message]
2012-02-02 14:00 ` [PATCH 2/3] drivers/net/ethernet/ti/davinci_xxx.c: " Julia Lawall
2012-02-02 14:00 ` [PATCH 3/3] kernel/rcutorture.c: " Julia Lawall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1328191247-23792-2-git-send-email-Julia.Lawall@lip6.fr \
--to=julia.lawall@lip6.fr \
--cc=josh@joshtriplett.org \
--cc=julia@diku.dk \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).