diff options
author | Lukasz Luba <lukasz.luba@arm.com> | 2016-05-31 06:32:02 -0400 |
---|---|---|
committer | Zhang Rui <rui.zhang@intel.com> | 2016-06-01 10:21:19 -0400 |
commit | f840ab18bdf2e415dac21d09fbbbd2873111bd48 (patch) | |
tree | 41c3ba2ccc87af930cfaa0e2c523a9b118e3747f | |
parent | 852f42a69b93dc71507adedeed876d57b8c2c2fa (diff) |
thermal: cpu_cooling: fix improper order during initialization
The freq_table array is not populated before calling
thermal_of_cooling_register. The code which populates the freq table was
introduced in commit f6859014.
This should be done before registering new thermal cooling device.
The log shows effects of this wrong decision.
[ 2.172614] cpu cpu1: Failed to get voltage for frequency 1984518656000: -34
[ 2.220863] cpu cpu0: Failed to get voltage for frequency 1984524416000: -34
Cc: <stable@vger.kernel.org> # 3.19+
Fixes: f6859014c7e7 ("thermal: cpu_cooling: Store frequencies in descending order")
Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
Acked-by: Javi Merino <javi.merino@arm.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
-rw-r--r-- | drivers/thermal/cpu_cooling.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 6ceac4f2d4b2..5b4b47ed948b 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c | |||
@@ -857,14 +857,6 @@ __cpufreq_cooling_register(struct device_node *np, | |||
857 | goto free_power_table; | 857 | goto free_power_table; |
858 | } | 858 | } |
859 | 859 | ||
860 | snprintf(dev_name, sizeof(dev_name), "thermal-cpufreq-%d", | ||
861 | cpufreq_dev->id); | ||
862 | |||
863 | cool_dev = thermal_of_cooling_device_register(np, dev_name, cpufreq_dev, | ||
864 | &cpufreq_cooling_ops); | ||
865 | if (IS_ERR(cool_dev)) | ||
866 | goto remove_idr; | ||
867 | |||
868 | /* Fill freq-table in descending order of frequencies */ | 860 | /* Fill freq-table in descending order of frequencies */ |
869 | for (i = 0, freq = -1; i <= cpufreq_dev->max_level; i++) { | 861 | for (i = 0, freq = -1; i <= cpufreq_dev->max_level; i++) { |
870 | freq = find_next_max(table, freq); | 862 | freq = find_next_max(table, freq); |
@@ -877,6 +869,14 @@ __cpufreq_cooling_register(struct device_node *np, | |||
877 | pr_debug("%s: freq:%u KHz\n", __func__, freq); | 869 | pr_debug("%s: freq:%u KHz\n", __func__, freq); |
878 | } | 870 | } |
879 | 871 | ||
872 | snprintf(dev_name, sizeof(dev_name), "thermal-cpufreq-%d", | ||
873 | cpufreq_dev->id); | ||
874 | |||
875 | cool_dev = thermal_of_cooling_device_register(np, dev_name, cpufreq_dev, | ||
876 | &cpufreq_cooling_ops); | ||
877 | if (IS_ERR(cool_dev)) | ||
878 | goto remove_idr; | ||
879 | |||
880 | cpufreq_dev->clipped_freq = cpufreq_dev->freq_table[0]; | 880 | cpufreq_dev->clipped_freq = cpufreq_dev->freq_table[0]; |
881 | cpufreq_dev->cool_dev = cool_dev; | 881 | cpufreq_dev->cool_dev = cool_dev; |
882 | 882 | ||