* Coverity: mlx90632_probe(): Error handling issues
@ 2022-11-04 19:35 coverity-bot
2022-11-05 12:51 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: coverity-bot @ 2022-11-04 19:35 UTC (permalink / raw)
To: Crt Mori
Cc: linux-iio, Lars-Peter Clausen, linux-kernel, Jonathan Cameron,
Jonathan Cameron, Gustavo A. R. Silva, linux-next,
linux-hardening
Hello!
This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20221104 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan
You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:
Thu Nov 3 21:42:26 2022 +0000
c83d3e5ca97f ("iio: temperature: mlx90632 Add runtime powermanagement modes")
Coverity reported the following:
*** CID 1527134: Error handling issues (CHECKED_RETURN)
drivers/iio/temperature/mlx90632.c:1270 in mlx90632_probe()
1264 mlx90632->object_ambient_temperature = 25000; /* 25 degrees milliCelsius */
1265 mlx90632->interaction_ts = jiffies; /* Set initial value */
1266
1267 pm_runtime_get_noresume(&client->dev);
1268 pm_runtime_set_active(&client->dev);
1269
vvv CID 1527134: Error handling issues (CHECKED_RETURN)
vvv Calling "devm_pm_runtime_enable" without checking return value (as is done elsewhere 21 out of 24 times).
1270 devm_pm_runtime_enable(&client->dev);
1271 pm_runtime_set_autosuspend_delay(&client->dev, MLX90632_SLEEP_DELAY_MS);
1272 pm_runtime_use_autosuspend(&client->dev);
1273 pm_runtime_put_autosuspend(&client->dev);
1274
1275 return devm_iio_device_register(&client->dev, indio_dev);
If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):
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")
Thanks for your attention!
--
Coverity-bot
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Coverity: mlx90632_probe(): Error handling issues
2022-11-04 19:35 Coverity: mlx90632_probe(): Error handling issues coverity-bot
@ 2022-11-05 12:51 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2022-11-05 12:51 UTC (permalink / raw)
To: coverity-bot, linux-kernel
Cc: Crt Mori, linux-iio, Lars-Peter Clausen, Jonathan Cameron,
Gustavo A. R. Silva, linux-next, linux-hardening
On Fri, 4 Nov 2022 12:35:22 -0700
coverity-bot <keescook@chromium.org> wrote:
> Hello!
>
> This is an experimental semi-automated report about issues detected by
> Coverity from a scan of next-20221104 as part of the linux-next scan project:
> https://scan.coverity.com/projects/linux-next-weekly-scan
>
> You're getting this email because you were associated with the identified
> lines of code (noted below) that were touched by commits:
>
> Thu Nov 3 21:42:26 2022 +0000
> c83d3e5ca97f ("iio: temperature: mlx90632 Add runtime powermanagement modes")
>
> Coverity reported the following:
>
> *** CID 1527134: Error handling issues (CHECKED_RETURN)
> drivers/iio/temperature/mlx90632.c:1270 in mlx90632_probe()
> 1264 mlx90632->object_ambient_temperature = 25000; /* 25 degrees milliCelsius */
> 1265 mlx90632->interaction_ts = jiffies; /* Set initial value */
> 1266
> 1267 pm_runtime_get_noresume(&client->dev);
> 1268 pm_runtime_set_active(&client->dev);
> 1269
> vvv CID 1527134: Error handling issues (CHECKED_RETURN)
> vvv Calling "devm_pm_runtime_enable" without checking return value (as is done elsewhere 21 out of 24 times).
> 1270 devm_pm_runtime_enable(&client->dev);
> 1271 pm_runtime_set_autosuspend_delay(&client->dev, MLX90632_SLEEP_DELAY_MS);
> 1272 pm_runtime_use_autosuspend(&client->dev);
> 1273 pm_runtime_put_autosuspend(&client->dev);
> 1274
> 1275 return devm_iio_device_register(&client->dev, indio_dev);
>
> If this is a false positive, please let us know so we can mark it as
> such, or teach the Coverity rules to be smarter. If not, please make
> sure fixes get into linux-next. :) For patches fixing this, please
> include these lines (but double-check the "Fixes" first):
>
> 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")
>
> Thanks for your attention!
>
I'll post a fix shortly. Looks like a simple
ret = devm_pm_runtime_enable()...
if (ret)
return ret;
will be enough here.
Also turns out there is a missing static marking related to the pm support. I'll fix
that too. Not sure why I didn't get a 0-day report for that.
Thanks,
Jonathan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-05 12:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-04 19:35 Coverity: mlx90632_probe(): Error handling issues coverity-bot
2022-11-05 12:51 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox