Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1415289 > unrolled thread

[PATCH 1/2] thermal: helpers: Check return value of get_temp

Started byRhyland Klein <rklein@nvidia.com>
First post2016-06-06 19:00 +0200
Last post2016-06-06 19:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/2] thermal: helpers: Check return value of get_temp Rhyland Klein <rklein@nvidia.com> - 2016-06-06 19:00 +0200

#1415289 — [PATCH 1/2] thermal: helpers: Check return value of get_temp

FromRhyland Klein <rklein@nvidia.com>
Date2016-06-06 19:00 +0200
Subject[PATCH 1/2] thermal: helpers: Check return value of get_temp
Message-ID<rH62B-7uD-13@gated-at.bofh.it>
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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web