[<prev] [next>] [day] [month] [year] [list]
Message-id: <001301cdcd02$0f6bbcc0$2e433640$%choi@samsung.com>
Date: Wed, 28 Nov 2012 09:48:19 +0900
From: Jonghwan Choi <jhbird.choi@...sung.com>
To: 'Jonghwan Choi' <jhbird.choi@...sung.com>,
'open list' <linux-kernel@...r.kernel.org>
Cc: 'Amit Daniel Kachhap' <amit.kachhap@...aro.org>,
'Zhang Rui' <rui.zhang@...el.com>,
'Sachin Kamat' <sachin.kamat@...aro.org>
Subject: [PATCH 2/2] thermal: exynos: Add error handling for temperature code
If temperature code is invalid, it should be handled.
Signed-off-by: Jonghwan Choi <jhbird.choi@...sung.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists