thermal: exynos: Add error handling for temperature code
Subsystems (2)
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 <[email protected]>
--- drivers/thermal/exynos_thermal.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
(quoted diff) +0 -0
b/drivers/thermal/exynos_thermal.c
index dc2ad6c..78c5c08 100644
drivers/thermal/exynos_thermal.c +0 -0
@@ -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