From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Julia Lawall <julia@diku.dk>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kernel-janitors@vger.kernel.org"
<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH] drivers/regulator: use PTR_ERR to get error code
Date: Sat, 21 Nov 2009 21:33:25 +0000 [thread overview]
Message-ID: <542581F2-4F09-4771-B8C6-D81DC890ABC9@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0911212218210.28848@ask.diku.dk> (sfid-20091121_211852_064475_1FE64446)
On 21 Nov 2009, at 21:18, Julia Lawall <julia@diku.dk> wrote:
> From: Julia Lawall <julia@diku.dk>
>
> IS_ERR returns only 1 or 0. The callsite of setup_regulators
> expects a
> negative integer in an error case. Thus, PTR_ERR has to be used to
> extract
> it.
>
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @@
> expression E,E1;
> @@
>
> *E = IS_ERR(...)
> ... when != E = E1
> *return E;
> // </smpl>
>
> Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: <broonie@opensource.wolfsonmicro.com>
>
> ---
> drivers/regulator/lp3971.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/regulator/lp3971.c b/drivers/regulator/lp3971.c
> index 7803a32..76d08c2 100644
> --- a/drivers/regulator/lp3971.c
> +++ b/drivers/regulator/lp3971.c
> @@ -446,8 +446,8 @@ static int setup_regulators(struct lp3971 *lp3971,
> lp3971->rdev[i] = regulator_register(®ulators[id],
> lp3971->dev, pdata->regulators[i].initdata, lp3971);
>
> - err = IS_ERR(lp3971->rdev[i]);
> - if (err) {
> + if (IS_ERR(lp3971->rdev[i])) {
> + err = PTR_ERR(lp3971->rdev[i]);
> dev_err(lp3971->dev, "regulator init failed: %d\n",
> err);
> goto error;
next prev parent reply other threads:[~2009-11-21 21:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-21 21:18 Julia Lawall
2009-11-21 21:33 ` Mark Brown [this message]
2009-11-23 10:55 ` Liam Girdwood
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=542581F2-4F09-4771-B8C6-D81DC890ABC9@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=julia@diku.dk \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@slimlogic.co.uk \
/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
all inboxes | Powered by JetHome®