thermal: exynos: Check the range of temperature code
Subsystems (2)
PATCH 1/2 thermal: exynos: Check the range of temperature code
The temperature code should range between 46 and 146.
Signed-off-by Jonghwan Choi <[email protected]>
--- drivers/thermal/exynos_thermal.c | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-)
(quoted diff) +0 -0
b/drivers/thermal/exynos_thermal.c
index 6dd29e4..dc2ad6c 100644
drivers/thermal/exynos_thermal.c +14 -7
@@ -530,14 +530,21 @@ out:static int code_to_temp (struct exynos_tmu_data *data,u8 temp_code) {struct exynos_tmu_platform_data *pdata = data->pdata; -int temp; +int min, max, temp; -if (data->soc ==SOC_ARCH_EXYNOS4210 ) -/* temp_code should range between 75 and 175 */ -if (temp_code <75 || temp_code >175 ) { - temp = -ENODATA ; - goto out; - } +if (data->soc ==SOC_ARCH_EXYNOS4210 ) { + min =75 ; + max =175 ; + }else { + min =46 ; + max =146 ; + } + +/* temp_code should range between min and max */ +if (temp_code < min || temp_code > max) { + temp = -ENODATA ; + goto out; + }switch (pdata->cal_type) {case TYPE_TWO_POINT_TRIMMING :
--
1.7.4.1