[PATCH 07/10] thermal/drivers/imx91: Acquire runtime PM reference in imx91_tmu_get_temp()
Lee Jones
lee at kernel.org
Thu Dec 3 11:54:18 PST 2026
The thermal core allows get_temp() to be called via sysfs even when the
thermal zone has been disabled and imx91_tmu_change_mode() has dropped
the runtime PM reference, gating the TMU clock. Reading IMX91_TMU_DATA0
in imx91_tmu_get_temp() while the clock is disabled causes an unclocked
register access.
Wrap the register read in imx91_tmu_get_temp() with
pm_runtime_resume_and_get() and pm_runtime_put().
Fixes: c411d8bf0699 ("thermal/drivers/imx91: Add support for i.MX91 thermal monitoring unit")
Closes: https://sashiko.dev/#/bug/linux-366503cb-0dfd-43b0-9c97-f75af5382e66
Cc: stable at vger.kernel.org
Signed-off-by: Lee Jones <lee at kernel.org>
---
drivers/thermal/imx91_thermal.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/thermal/imx91_thermal.c b/drivers/thermal/imx91_thermal.c
index 6d0aba992244..c3a72df665a8 100644
--- a/drivers/thermal/imx91_thermal.c
+++ b/drivers/thermal/imx91_thermal.c
@@ -110,11 +110,18 @@ static int imx91_tmu_get_temp(struct thermal_zone_device *tz, int *temp)
{
struct imx91_tmu *tmu = thermal_zone_device_priv(tz);
s16 data;
+ int ret;
+
+ ret = pm_runtime_resume_and_get(tmu->dev);
+ if (ret < 0)
+ return ret;
/* DATA0 is 16bit signed number */
data = readw_relaxed(tmu->base + IMX91_TMU_DATA0);
*temp = imx91_tmu_to_mcelsius(data);
+ pm_runtime_put(tmu->dev);
+
return 0;
}
--
2.56.1.911.g883d8bcb20-goog
More information about the linux-arm-kernel
mailing list