public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: coverity-bot <keescook@chromium.org>, linux-kernel@vger.kernel.org
Cc: Crt Mori <cmo@melexis.com>,
	linux-iio@vger.kernel.org, Lars-Peter Clausen <lars@metafoo.de>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	linux-next@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: Coverity: mlx90632_probe(): Error handling issues
Date: Sat, 5 Nov 2022 12:51:31 +0000	[thread overview]
Message-ID: <20221105125131.04710178@jic23-huawei> (raw)
In-Reply-To: <202211041235.FB1AF7F6F@keescook>

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

      reply	other threads:[~2022-11-05 12:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-04 19:35 Coverity: mlx90632_probe(): Error handling issues coverity-bot
2022-11-05 12:51 ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221105125131.04710178@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=cmo@melexis.com \
    --cc=gustavo@embeddedor.com \
    --cc=keescook@chromium.org \
    --cc=lars@metafoo.de \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox