Skip to content

Commit c8da6cd

Browse files
mszyprowEduardo Valentin
authored andcommitted
thermal: exynos: Propagate error value from tmu_read()
tmu_read() in case of Exynos4210 might return error for out of bound values. Current code ignores such value, what leads to reporting critical temperature value. Add proper error code propagation to exynos_get_temp() function. Signed-off-by: Marek Szyprowski <[email protected]> CC: [email protected] # v4.6+ Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]> Signed-off-by: Eduardo Valentin <[email protected]>
1 parent 88fc6f7 commit c8da6cd

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/thermal/samsung/exynos_tmu.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -892,19 +892,24 @@ static void exynos7_tmu_control(struct platform_device *pdev, bool on)
892892
static int exynos_get_temp(void *p, int *temp)
893893
{
894894
struct exynos_tmu_data *data = p;
895+
int value, ret = 0;
895896

896897
if (!data || !data->tmu_read || !data->enabled)
897898
return -EINVAL;
898899

899900
mutex_lock(&data->lock);
900901
clk_enable(data->clk);
901902

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;
903908

904909
clk_disable(data->clk);
905910
mutex_unlock(&data->lock);
906911

907-
return 0;
912+
return ret;
908913
}
909914

910915
#ifdef CONFIG_THERMAL_EMULATION

0 commit comments

Comments
 (0)