[COMMON] thermal: samsung: Fix cooling_deivce regstier fail.
authorHyeonseong Gil <hs.gil@samsung.com>
Mon, 18 Jul 2016 06:02:46 +0000 (15:02 +0900)
committerChungwoo Park <cww.park@samsung.com>
Mon, 21 May 2018 08:13:03 +0000 (17:13 +0900)
If cooling_device register is failed,
we do not want to enable thermal zone.

Change-Id: Id7b1b0380db0d3b924cbaa02c42977d7face4612
Signed-off-by: Hyeonseong Gil <hs.gil@samsung.com>
drivers/thermal/samsung/exynos_tmu.c

index f5e5459232768a9997d7eedeca87c7ce0f7d6822..36e242f2a3496d02150557a251c7670dea50c854 100644 (file)
@@ -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