blob: 5a7bf35ce102a323149269e2908a5b55e853901c [file] [log] [blame]
From bee5fa066c86d7a6df294f5e1e08b68656a2b4d8 Mon Sep 17 00:00:00 2001
From: Brian Norris <briannorris@chromium.org>
Date: Fri, 18 Nov 2016 15:52:55 -0800
Subject: [PATCH] FROMLIST: 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@chromium.org>
(am from https://patchwork.kernel.org/patch/9437679/)
BUG=chrome-os-partner:60076
TEST=boot kevin; check for thermal errors in console
Change-Id: I46f0d948e773268dae81e63691762604907f76a1
Reviewed-on: https://chromium-review.googlesource.com/413066
Commit-Ready: Brian Norris <briannorris@chromium.org>
Tested-by: Caesar Wang <wxt@rock-chips.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Caesar Wang <wxt@rock-chips.com>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Conflicts:
drivers/thermal/thermal_core.c
[rebase412(groeck): Function moved to another file]
Signed-off-by: Guenter Roeck <groeck@chromium.org>
---
drivers/thermal/thermal_helpers.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c
index c65cdce8f856e5112033317af2321e1ac3313d4c..12fc648d92505b03d970c08aa5fce01624b64a0b 100644
--- a/drivers/thermal/thermal_helpers.c
+++ b/drivers/thermal/thermal_helpers.c
@@ -77,6 +77,8 @@ int __thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
return -EINVAL;
ret = tz->ops->get_temp(tz, temp);
+ if (ret)
+ return ret;
if (IS_ENABLED(CONFIG_THERMAL_EMULATION) && tz->emul_temperature) {
for (count = 0; count < tz->num_trips; count++) {
--
2.38.1.584.g0f3c55d4c2-goog