diff options
| -rw-r--r-- | drivers/thermal/samsung/exynos_tmu.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 986cbd01aaaa..ac83f721db24 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c | |||
| @@ -892,6 +892,7 @@ static void exynos7_tmu_control(struct platform_device *pdev, bool on) | |||
| 892 | static int exynos_get_temp(void *p, int *temp) | 892 | static int exynos_get_temp(void *p, int *temp) |
| 893 | { | 893 | { |
| 894 | struct exynos_tmu_data *data = p; | 894 | struct exynos_tmu_data *data = p; |
| 895 | int value, ret = 0; | ||
| 895 | 896 | ||
| 896 | if (!data || !data->tmu_read || !data->enabled) | 897 | if (!data || !data->tmu_read || !data->enabled) |
| 897 | return -EINVAL; | 898 | return -EINVAL; |
| @@ -899,12 +900,16 @@ static int exynos_get_temp(void *p, int *temp) | |||
| 899 | mutex_lock(&data->lock); | 900 | mutex_lock(&data->lock); |
| 900 | clk_enable(data->clk); | 901 | clk_enable(data->clk); |
| 901 | 902 | ||
| 902 | *temp = code_to_temp(data, data->tmu_read(data)) * MCELSIUS; | 903 | value = data->tmu_read(data); |
| 904 | if (value < 0) | ||
| 905 | ret = value; | ||
| 906 | else | ||
| 907 | *temp = code_to_temp(data, value) * MCELSIUS; | ||
| 903 | 908 | ||
| 904 | clk_disable(data->clk); | 909 | clk_disable(data->clk); |
| 905 | mutex_unlock(&data->lock); | 910 | mutex_unlock(&data->lock); |
| 906 | 911 | ||
| 907 | return 0; | 912 | return ret; |
| 908 | } | 913 | } |
| 909 | 914 | ||
| 910 | #ifdef CONFIG_THERMAL_EMULATION | 915 | #ifdef CONFIG_THERMAL_EMULATION |
