From: Frank Li <Frank.li@nxp.com>
To: Felix Gu <ustc.gu@gmail.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Daniel Lezcano <daniel.lezcano@kernel.org>,
Zhang Rui <rui.zhang@intel.com>,
Lukasz Luba <lukasz.luba@arm.com>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Oleksij Rempel <o.rempel@pengutronix.de>,
linux-pm@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] thermal/drivers/imxl:Fix runtime PM handling on early returns
Date: Sat, 11 Apr 2026 21:00:40 -0400 [thread overview]
Message-ID: <adruuOUj7IpBlcio@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260412-imx-v1-2-cc3b45d63811@gmail.com>
On Sun, Apr 12, 2026 at 03:03:04AM +0800, Felix Gu wrote:
> Use PM_RUNTIME_ACQUIRE() in imx_get_temp() and imx_set_trip_temp() so
> runtime PM references are released correctly even when the functions
> return early on errors.
>
> Fixes: 4cf2ddf16e17 ("thermal/drivers/imx: Implement runtime PM support")
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> drivers/thermal/imx_thermal.c | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
> index 68f9ce41a670..9d9ae7871068 100644
> --- a/drivers/thermal/imx_thermal.c
> +++ b/drivers/thermal/imx_thermal.c
> @@ -260,8 +260,9 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp)
> u32 val;
> int ret;
>
> - ret = pm_runtime_resume_and_get(data->dev);
> - if (ret < 0)
> + PM_RUNTIME_ACQUIRE(data->dev, pm);
> + ret = PM_RUNTIME_ACQUIRE_ERR(&pm);
> + if (ret)
> return ret;
>
> regmap_read(map, soc_data->temp_data, &val);
> @@ -302,8 +303,6 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp)
> enable_irq(data->irq);
> }
>
> - pm_runtime_put(data->dev);
> -
> return 0;
> }
>
> @@ -337,8 +336,9 @@ static int imx_set_trip_temp(struct thermal_zone_device *tz,
> struct imx_thermal_data *data = thermal_zone_device_priv(tz);
> int ret;
>
> - ret = pm_runtime_resume_and_get(data->dev);
> - if (ret < 0)
> + PM_RUNTIME_ACQUIRE(data->dev, pm);
> + ret = PM_RUNTIME_ACQUIRE_ERR(&pm);
> + if (ret)
> return ret;
>
> /* do not allow passive to be set higher than critical */
> @@ -348,8 +348,6 @@ static int imx_set_trip_temp(struct thermal_zone_device *tz,
> imx_set_alarm_temp(data, temp);
> trips[IMX_TRIP_PASSIVE].temperature = temp;
>
> - pm_runtime_put(data->dev);
> -
> return 0;
> }
>
>
> --
> 2.43.0
>
prev parent reply other threads:[~2026-04-12 1:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-11 19:03 [PATCH 0/2] thermal/drivers/imx: two fixes Felix Gu
2026-04-11 19:03 ` [PATCH 1/2] thermal/drivers/imx: Fix thermal zone leak on probe error path Felix Gu
2026-04-12 0:58 ` Frank Li
2026-04-11 19:03 ` [PATCH 2/2] thermal/drivers/imxl:Fix runtime PM handling on early returns Felix Gu
2026-04-12 1:00 ` Frank Li [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=adruuOUj7IpBlcio@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=daniel.lezcano@kernel.org \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=o.rempel@pengutronix.de \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
--cc=s.hauer@pengutronix.de \
--cc=ustc.gu@gmail.com \
/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