linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: kernel-janitors@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-iio@vger.kernel.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging:iio: correct error check
Date: Wed, 01 Jan 2014 12:35:55 +0000	[thread overview]
Message-ID: <52C40BAB.4060703@kernel.org> (raw)
In-Reply-To: <1388581641-26782-1-git-send-email-Julia.Lawall@lip6.fr>



On 01/01/14 13:07, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> iio_kfifo_allocate returns NULL in case of error.
>
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @@
> expression *x;
> identifier f;
> statement S1,S2;
> @@
>
> *x = f(...);
>   if (x) { <+... when != if (...) S1 else S2
>       -ENOMEM ...+> }
> // </smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Thanks. Certainly an 'interesting' bit of code :(

Applied to the fixes-togreg branch of iio.git. Giving timing in the 
current cycle and that it isn't a recent regression, this won't go
in now until after 3.13 is released.

I've marked it for stable as well

Jonathan
>
> ---
>   drivers/staging/iio/impedance-analyzer/ad5933.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
> index 0a4298b..2b96665 100644
> --- a/drivers/staging/iio/impedance-analyzer/ad5933.c
> +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
> @@ -629,7 +629,7 @@ static int ad5933_register_ring_funcs_and_init(struct iio_dev *indio_dev)
>   	struct iio_buffer *buffer;
>
>   	buffer = iio_kfifo_allocate(indio_dev);
> -	if (buffer)
> +	if (!buffer)
>   		return -ENOMEM;
>
>   	iio_device_attach_buffer(indio_dev, buffer);
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

      reply	other threads:[~2014-01-01 12:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-01 13:07 [PATCH] staging:iio: correct error check Julia Lawall
2014-01-01 12:35 ` Jonathan Cameron [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=52C40BAB.4060703@kernel.org \
    --to=jic23@kernel.org \
    --cc=Julia.Lawall@lip6.fr \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-iio@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).