[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20090206140505.GH3341@sortiz.org>
Date: Fri, 6 Feb 2009 15:05:06 +0100
From: Samuel Ortiz <sameo@...nedhand.com>
To: Julia Lawall <julia@...u.dk>
Cc: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] drivers/mfd: Adjust NULL test
On Sun, Dec 21, 2008 at 07:08:09PM +0100, Julia Lawall wrote:
> From: Julia Lawall <julia@...u.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@...u.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/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists