diff mbox series

[1/2] iio: temperature: mlx90632: Add error handling for devm_pm_runtime_enable()

Message ID 20221105125108.383193-2-jic23@kernel.org (mailing list archive)
State Accepted
Headers show
Series iio: mlx90632: Minor fixes | expand

Commit Message

Jonathan Cameron Nov. 5, 2022, 12:51 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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: c83d3e5ca97f ("iio: temperature: mlx90632 Add runtime powermanagement modes")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/temperature/mlx90632.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Crt Mori Nov. 7, 2022, 9:50 a.m. UTC | #1
Acked-off-by: Crt Mori <cmo@melexis.com>

On Sat, 5 Nov 2022 at 13:51, Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> 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: c83d3e5ca97f ("iio: temperature: mlx90632 Add runtime powermanagement modes")
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
>  drivers/iio/temperature/mlx90632.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/temperature/mlx90632.c b/drivers/iio/temperature/mlx90632.c
> index a17fe5f4967a..7572ae3f8432 100644
> --- a/drivers/iio/temperature/mlx90632.c
> +++ b/drivers/iio/temperature/mlx90632.c
> @@ -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);
> --
> 2.38.1
>
diff mbox series

Patch

diff --git a/drivers/iio/temperature/mlx90632.c b/drivers/iio/temperature/mlx90632.c
index a17fe5f4967a..7572ae3f8432 100644
--- a/drivers/iio/temperature/mlx90632.c
+++ b/drivers/iio/temperature/mlx90632.c
@@ -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);