linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rhyland Klein <rklein@nvidia.com>
To: Zhang Rui <rui.zhang@intel.com>, Eduardo Valentin <edubezval@gmail.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Rhyland Klein <rklein@nvidia.com>
Subject: [RESEND PATCH] thermal: helpers: Check return value of get_temp
Date: Mon, 6 Jun 2016 12:53:39 -0400	[thread overview]
Message-ID: <1465232019-12441-1-git-send-email-rklein@nvidia.com> (raw)

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

             reply	other threads:[~2016-06-06 16:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-06 16:53 Rhyland Klein [this message]
2016-06-23 17:40 ` [RESEND PATCH] thermal: helpers: Check return value of get_temp Rhyland Klein
2016-07-05 16:22 ` Rhyland Klein
2016-07-28  8:50   ` Zhang Rui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1465232019-12441-1-git-send-email-rklein@nvidia.com \
    --to=rklein@nvidia.com \
    --cc=edubezval@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).