linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] thermal: handle get_temp() errors properly
@ 2016-11-18 23:52 Brian Norris
  2016-11-18 23:52 ` [PATCH 2/3] thermal: rockchip: improve conversion error messages Brian Norris
                   ` (3 more replies)
  0 siblings, 4 replies; 19+ messages in thread
From: Brian Norris @ 2016-11-18 23:52 UTC (permalink / raw)
  To: Zhang Rui, Eduardo Valentin
  Cc: Heiko Stuebner, linux-pm, linux-rockchip, linux-kernel,
	Caesar Wang, Stephen Barber, Brian Norris

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>
---
 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


^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2017-09-08 18:15 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-18 23:52 [PATCH 1/3] thermal: handle get_temp() errors properly Brian Norris
2016-11-18 23:52 ` [PATCH 2/3] thermal: rockchip: improve conversion error messages Brian Norris
2016-11-19  3:31   ` Caesar Wang
2016-11-19  3:35     ` Caesar Wang
2016-11-22  1:51     ` Caesar Wang
2016-11-22  2:15       ` Brian Norris
2016-11-22  2:33         ` Caesar Wang
2016-11-22  3:43           ` Brian Norris
2016-11-22  7:57       ` Zhang Rui
2016-11-22 12:44         ` Caesar Wang
     [not found] ` <1479513177-81504-1-git-send-email-briannorris-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2016-11-18 23:52   ` [PATCH 3/3] thermal: rockchip: don't pass table structs by value Brian Norris
2016-11-19  4:03     ` Caesar Wang
2016-11-19  3:21 ` [PATCH 1/3] thermal: handle get_temp() errors properly Caesar Wang
2016-11-19  3:41 ` Eduardo Valentin
2016-11-19  5:30   ` Brian Norris
2016-11-22  7:52     ` Zhang Rui
2016-11-22 11:00       ` Eduardo Valentin
     [not found]         ` <20161122110045.GB2018-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2016-11-22 22:27           ` Brian Norris
2017-09-08 18:15             ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).