From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from saturn.retrosnub.co.uk ([178.18.118.26]:45917 "EHLO saturn.retrosnub.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753575AbaAAMf4 (ORCPT ); Wed, 1 Jan 2014 07:35:56 -0500 Message-ID: <52C40BAB.4060703@kernel.org> Date: Wed, 01 Jan 2014 12:35:55 +0000 From: Jonathan Cameron MIME-Version: 1.0 To: Julia Lawall CC: kernel-janitors@vger.kernel.org, Greg Kroah-Hartman , linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging:iio: correct error check References: <1388581641-26782-1-git-send-email-Julia.Lawall@lip6.fr> In-Reply-To: <1388581641-26782-1-git-send-email-Julia.Lawall@lip6.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Sender: linux-iio-owner@vger.kernel.org List-Id: linux-iio@vger.kernel.org On 01/01/14 13:07, Julia Lawall wrote: > From: Julia Lawall > > iio_kfifo_allocate returns NULL in case of error. > > The semantic match that finds this problem is as follows: > (http://coccinelle.lip6.fr/) > > // > @@ > expression *x; > identifier f; > statement S1,S2; > @@ > > *x = f(...); > if (x) { <+... when != if (...) S1 else S2 > -ENOMEM ...+> } > // > > Signed-off-by: Julia Lawall 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 >