From: Jonghwan Choi <jhbird.choi@samsung.com>
To: "'Jonghwan Choi'" <jhbird.choi@samsung.com>,
"'open list'" <linux-kernel@vger.kernel.org>
Cc: "'Amit Daniel Kachhap'" <amit.kachhap@linaro.org>,
"'Zhang Rui'" <rui.zhang@intel.com>,
"'Sachin Kamat'" <sachin.kamat@linaro.org>
Subject: [PATCH 2/2] thermal: exynos: Add error handling for temperature code
Date: Wed, 28 Nov 2012 09:48:19 +0900 [thread overview]
Message-ID: <001301cdcd02$0f6bbcc0$2e433640$%choi@samsung.com> (raw)
In-Reply-To:
If temperature code is invalid, it should be handled.
Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
---
drivers/thermal/exynos_thermal.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/thermal/exynos_thermal.c
b/drivers/thermal/exynos_thermal.c
index dc2ad6c..78c5c08 100644
--- a/drivers/thermal/exynos_thermal.c
+++ b/drivers/thermal/exynos_thermal.c
@@ -346,15 +346,19 @@ static int exynos_get_temp(struct thermal_zone_device
*thermal,
unsigned long *temp)
{
void *data;
+ int tmp;
if (!th_zone->sensor_conf) {
pr_info("Temperature sensor not initialised\n");
return -EINVAL;
}
data = th_zone->sensor_conf->private_data;
- *temp = th_zone->sensor_conf->read_temperature(data);
+ tmp = th_zone->sensor_conf->read_temperature(data);
+ if (tmp < 0)
+ return tmp;
+
/* convert the temperature into millicelsius */
- *temp = *temp * MCELSIUS;
+ *temp = tmp * MCELSIUS;
return 0;
}
--
1.7.4.1
reply other threads:[~2012-11-28 0:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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='001301cdcd02$0f6bbcc0$2e433640$%choi@samsung.com' \
--to=jhbird.choi@samsung.com \
--cc=amit.kachhap@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rui.zhang@intel.com \
--cc=sachin.kamat@linaro.org \
/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
all inboxes | Powered by JetHome®