All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH] thermal: helpers: Check return value of get_temp
@ 2016-06-06 16:53 ` Rhyland Klein
  0 siblings, 0 replies; 7+ messages in thread
From: Rhyland Klein @ 2016-06-06 16:53 UTC (permalink / raw)
  To: Zhang Rui, Eduardo Valentin; +Cc: linux-pm, linux-kernel, Rhyland Klein

Check the return value of get_temp, which can fail. If it does, then
unlock and return the error code.

Signed-off-by: Rhyland Klein <rklein@nvidia.com>
---
 drivers/thermal/thermal_helpers.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c
index 5e1c160944c9..dc260749f8d6 100644
--- a/drivers/thermal/thermal_helpers.c
+++ b/drivers/thermal/thermal_helpers.c
@@ -90,6 +90,10 @@ 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) {
+		mutex_unlock(&tz->lock);
+		goto exit;
+	}
 
 	if (IS_ENABLED(CONFIG_THERMAL_EMULATION) && tz->emul_temperature) {
 		for (count = 0; count < tz->trips; count++) {
-- 
1.9.1

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

end of thread, other threads:[~2016-07-28  8:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-06 16:53 [RESEND PATCH] thermal: helpers: Check return value of get_temp Rhyland Klein
2016-06-06 16:53 ` Rhyland Klein
2016-06-23 17:40 ` Rhyland Klein
2016-06-23 17:40   ` Rhyland Klein
2016-07-05 16:22 ` Rhyland Klein
2016-07-05 16:22   ` Rhyland Klein
2016-07-28  8:50   ` Zhang Rui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.