public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Samuel Ortiz <sameo@openedhand.com>
To: Julia Lawall <julia@diku.dk>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] drivers/mfd: Adjust NULL test
Date: Fri, 6 Feb 2009 15:05:06 +0100	[thread overview]
Message-ID: <20090206140505.GH3341@sortiz.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0812211907400.9555@pc-004.diku.dk>

On Sun, Dec 21, 2008 at 07:08:09PM +0100, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
> 
> Since ei is already known to be non-NULL, I assume that what was intended
> was to test the result of kzalloc.
Makes sense, thanks. Applied to my for-linus branch.

Cheers,
Samuel.

 
> The semantic patch that makes this change is as follows:
> (http://www.emn.fr/x-info/coccinelle/)
> 
> // <smpl>
> @@
> expression E,E1;
> identifier f,fld,fld1;
> statement S1,S2;
> @@
> 
> E->fld = f(...);
> ... when != E = E1
>     when != E->fld1 = E1
> if (
> -   E
> +   E->fld
>            == NULL) S1 else S2
> // </smpl>
> 
> Signed-off-by: Julia Lawall <julia@diku.dk>
> 
> ---
>  drivers/mfd/htc-egpio.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff -u -p a/drivers/mfd/htc-egpio.c b/drivers/mfd/htc-egpio.c
> --- a/drivers/mfd/htc-egpio.c
> +++ b/drivers/mfd/htc-egpio.c
> @@ -307,7 +307,7 @@ static int __init egpio_probe(struct pla
>  
>  	ei->nchips = pdata->num_chips;
>  	ei->chip = kzalloc(sizeof(struct egpio_chip) * ei->nchips, GFP_KERNEL);
> -	if (!ei) {
> +	if (!ei->chip) {
>  		ret = -ENOMEM;
>  		goto fail;
>  	}

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

      reply	other threads:[~2009-02-06 14:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-21 18:08 [PATCH] drivers/mfd: Adjust NULL test Julia Lawall
2009-02-06 14:05 ` Samuel Ortiz [this message]

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=20090206140505.GH3341@sortiz.org \
    --to=sameo@openedhand.com \
    --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