Re: [PATCH -next] iio: adc: max9611: Fix return value check in max9611_probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 27/04/17 16:20, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@xxxxxxxxxx>
> 
> 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 <weiyongjun1@xxxxxxxxxx>
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);
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux