Re: Coverity: mlx90632_probe(): Error handling issues

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

 



On Fri, 4 Nov 2022 12:35:22 -0700
coverity-bot <keescook@xxxxxxxxxxxx> 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@xxxxxxxxxxxx>
> 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



[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux