From: sashiko-bot@kernel.org
To: "Cong Nguyen" <congnt264@gmail.com>
Cc: imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH] thermal/drivers/imx: drop the runtime PM reference on early error returns
Date: Sun, 29 Nov 2026 06:47:19 +0000 [thread overview]
Message-ID: <sashiko-outbox-239345@kernel.org> (raw)
In-Reply-To: <20261129064412.2874472-1-congnt264@gmail.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] thermal/imx: double pm_runtime_put() in imx_thermal_probe() [1]
--
commit 7763b771c159bce40eb214229e69123499779dca
Author: Cong Nguyen <congnt264@gmail.com>
thermal/drivers/imx: drop the runtime PM reference on early error returns
This commit drops the runtime PM reference on data->dev before returning early
on error in imx_get_temp() and imx_set_trip_temp().
> diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
> index 1a57aa9dc9001..3529b4a4cce1e 100644
> --- a/drivers/thermal/imx_thermal.c
> +++ b/drivers/thermal/imx_thermal.c
> @@ -266,8 +266,10 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp)
>
> regmap_read(map, soc_data->temp_data, &val);
>
> - if ((val & soc_data->temp_valid_mask) == 0)
> + if ((val & soc_data->temp_valid_mask) == 0) {
> + pm_runtime_put(data->dev);
> return -EAGAIN;
> + }
>
> n_meas = (val & soc_data->temp_value_mask)
> >> soc_data->temp_value_shift;
> @@ -342,8 +344,10 @@ static int imx_set_trip_temp(struct thermal_zone_device *tz,
> return ret;
>
> /* do not allow passive to be set higher than critical */
> - if (temp < 0 || temp > trips[IMX_TRIP_CRITICAL].temperature)
> + if (temp < 0 || temp > trips[IMX_TRIP_CRITICAL].temperature) {
> + pm_runtime_put(data->dev);
> return -EINVAL;
> + }
>
> imx_set_alarm_temp(data, temp);
> trips[IMX_TRIP_PASSIVE].temperature = temp;
[Severity: High]
This problem wasn't introduced by this patch, but can imx_thermal_probe()
underflow the runtime PM usage counter on data->dev [1] if
pm_runtime_resume_and_get() fails?
drivers/thermal/imx_thermal.c:imx_thermal_probe() {
...
ret = pm_runtime_resume_and_get(data->dev);
if (ret < 0)
goto disable_runtime_pm;
...
disable_runtime_pm:
pm_runtime_put_noidle(data->dev);
pm_runtime_disable(data->dev);
...
}
pm_runtime_resume_and_get() already drops its usage reference on failure, so
jumping to disable_runtime_pm decrements the usage counter a second time.
[1] https://sashiko.dev/#/bug/linux-2ad226fd-def3-4ce1-8261-087d5f0a6696
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261129064412.2874472-1-congnt264@gmail.com?part=1
prev parent reply other threads:[~2026-11-29 6:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 6:44 [PATCH] thermal/drivers/imx: drop the runtime PM reference on early error returns Cong Nguyen
2026-11-29 6:47 ` sashiko-bot [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=sashiko-outbox-239345@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=congnt264@gmail.com \
--cc=imx@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.