From a48fc5f1d68ba57682045fc8aee76ae441e3d22f Mon Sep 17 00:00:00 2001 From: Hyeonseong Gil Date: Mon, 18 Jul 2016 15:02:46 +0900 Subject: [PATCH] [COMMON] thermal: samsung: Fix cooling_deivce regstier fail. If cooling_device register is failed, we do not want to enable thermal zone. Change-Id: Id7b1b0380db0d3b924cbaa02c42977d7face4612 Signed-off-by: Hyeonseong Gil --- drivers/thermal/samsung/exynos_tmu.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index f5e545923276..36e242f2a349 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -214,6 +214,7 @@ static void exynos_report_trigger(struct exynos_tmu_data *p) break; } + snprintf(data, sizeof(data), "%u", i); kobject_uevent_env(&tz->device.kobj, KOBJ_CHANGE, envp); mutex_unlock(&tz->lock); @@ -1222,8 +1223,11 @@ static int exynos_cpufreq_cooling_register(struct exynos_tmu_data *data) data->cool_dev = of_cpufreq_power_cooling_register(cool_np, &mask_val, power_coefficient, NULL); - if (IS_ERR(data->cool_dev)) + if (IS_ERR(data->cool_dev)) { + data->cool_dev = NULL; pr_err("cooling device register fail (mask = %x) \n", *(unsigned int*)cpumask_bits(&mask_val)); + return -ENODEV; + } return ret; } @@ -1279,6 +1283,12 @@ static int exynos_gpufreq_cooling_register(struct exynos_tmu_data *data) data->cool_dev = of_gpufreq_power_cooling_register(cool_np, NULL, power_coefficient, NULL); + if (IS_ERR(data->cool_dev)) { + data->cool_dev = NULL; + pr_err("gpu cooling device register fail \n"); + return -ENODEV; + } + return ret; } #else @@ -1316,6 +1326,12 @@ static int exynos_isp_cooling_register(struct exynos_tmu_data *data) data->cool_dev = of_isp_cooling_register(cool_np, NULL); + if (IS_ERR(data->cool_dev)) { + data->cool_dev = NULL; + pr_err("isp cooling device register fail \n"); + return -ENODEV; + } + return ret; } #else -- 2.20.1