[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1479513177-81504-1-git-send-email-briannorris@chromium.org>
Date: Fri, 18 Nov 2016 15:52:55 -0800
From: Brian Norris <briannorris@...omium.org>
To: Zhang Rui <rui.zhang@...el.com>,
Eduardo Valentin <edubezval@...il.com>
Cc: Heiko Stuebner <heiko@...ech.de>, linux-pm@...r.kernel.org,
linux-rockchip@...ts.infradead.org, linux-kernel@...r.kernel.org,
Caesar Wang <wxt@...k-chips.com>,
Stephen Barber <smbarber@...omium.org>,
Brian Norris <briannorris@...omium.org>
Subject: [PATCH 1/3] thermal: handle get_temp() errors properly
If using CONFIG_THERMAL_EMULATION, there's a corner case where we might
get an error from the zone's get_temp() callback, but we'll ignore that
and keep using its value. Let's just error out properly instead.
Signed-off-by: Brian Norris <briannorris@...omium.org>
---
drivers/thermal/thermal_core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 911fd964c742..0fa497f10d25 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -494,6 +494,8 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
mutex_lock(&tz->lock);
ret = tz->ops->get_temp(tz, temp);
+ if (ret)
+ goto exit_unlock;
if (IS_ENABLED(CONFIG_THERMAL_EMULATION) && tz->emul_temperature) {
for (count = 0; count < tz->trips; count++) {
@@ -514,6 +516,7 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
*temp = tz->emul_temperature;
}
+exit_unlock:
mutex_unlock(&tz->lock);
exit:
return ret;
--
2.8.0.rc3.226.g39d4020
Powered by blists - more mailing lists