iio: temperature: mlx90632: Add error handling for devm_pm_runtime_enable()
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 5 Nov 2022 12:51:07 +0000 (12:51 +0000)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 23 Nov 2022 19:57:12 +0000 (19:57 +0000)
This call can fail so handling is necessary even if it is very unlikely.

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1527134 ("Error handling issues")
Fixes: 2aebc223fc7c ("iio: temperature: mlx90632 Add runtime powermanagement modes")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-off-by: Crt Mori <cmo@melexis.com>
Link: https://lore.kernel.org/r/20221105125108.383193-2-jic23@kernel.org
drivers/iio/temperature/mlx90632.c

index a17fe5f4967a6cd9613b7e5e2a8c66db58805037..7572ae3f843222214cd48fe064a6895e59a10dbf 100644 (file)
@@ -1267,7 +1267,10 @@ static int mlx90632_probe(struct i2c_client *client,
        pm_runtime_get_noresume(&client->dev);
        pm_runtime_set_active(&client->dev);
 
-       devm_pm_runtime_enable(&client->dev);
+       ret = devm_pm_runtime_enable(&client->dev);
+       if (ret)
+               return ret;
+
        pm_runtime_set_autosuspend_delay(&client->dev, MLX90632_SLEEP_DELAY_MS);
        pm_runtime_use_autosuspend(&client->dev);
        pm_runtime_put_autosuspend(&client->dev);