Return-Path: Received: from saturn.retrosnub.co.uk ([178.18.118.26]:34853 "EHLO saturn.retrosnub.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1425139AbdD3QeT (ORCPT ); Sun, 30 Apr 2017 12:34:19 -0400 Subject: Re: [PATCH -next] iio: adc: max9611: Fix return value check in max9611_probe() To: Wei Yongjun , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Jacopo Mondi Cc: Wei Yongjun , linux-iio@vger.kernel.org References: <20170427152036.30966-1-weiyj.lk@gmail.com> From: Jonathan Cameron Message-ID: Date: Sun, 30 Apr 2017 17:34:14 +0100 MIME-Version: 1.0 In-Reply-To: <20170427152036.30966-1-weiyj.lk@gmail.com> Content-Type: text/plain; charset=utf-8 Sender: linux-iio-owner@vger.kernel.org List-Id: linux-iio@vger.kernel.org On 27/04/17 16:20, Wei Yongjun wrote: > From: Wei Yongjun > > In case of error, the function devm_iio_device_alloc() returns > NULL pointer not ERR_PTR(). The IS_ERR() test in the return value > check should be replaced with NULL test. > > Signed-off-by: Wei Yongjun Good catch. Dan Carpenter also sent the same fix though and I've already applied that one. Thanks, Jonathan > --- > drivers/iio/adc/max9611.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/iio/adc/max9611.c b/drivers/iio/adc/max9611.c > index ec82106..dc3869b 100644 > --- a/drivers/iio/adc/max9611.c > +++ b/drivers/iio/adc/max9611.c > @@ -536,8 +536,8 @@ static int max9611_probe(struct i2c_client *client, > int ret; > > indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*max9611)); > - if (IS_ERR(indio_dev)) > - return PTR_ERR(indio_dev); > + if (!indio_dev) > + return -ENOMEM; > > i2c_set_clientdata(client, indio_dev); >