iio: adc: max9611: Fix return value check in max9611_probe()
PATCH 1/1 iio: adc: max9611: Fix return value check in max9611_probe()
From: Wei Yongjun <[email protected]>
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 <[email protected]>
--- drivers/iio/adc/max9611.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/max9611.c +2 -2
@@ -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);
Jonathan Cameron
maintainerQuoted 7 lines · Wei Yongjun
From: Wei Yongjun <[email protected]>
In case of error, the function
devm_iio_device_alloc()returns NULL pointer notERR_PTR(). TheIS_ERR()test in the return value check should be replaced with NULL test.Signed-off-by Wei Yongjun <[email protected]>
Good catch. Dan Carpenter also sent the same fix though and I've already applied that one.
Thanks,
Jonathan
Quoted 19 lines
--- drivers/iio/adc/max9611.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/adc/max9611.c +2
-2@@ -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);