]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.6.5/thermal-cpu_cooling-fix-improper-order-during-initialization.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.6.5 / thermal-cpu_cooling-fix-improper-order-during-initialization.patch
CommitLineData
700b5fa6
GKH
1From f840ab18bdf2e415dac21d09fbbbd2873111bd48 Mon Sep 17 00:00:00 2001
2From: Lukasz Luba <lukasz.luba@arm.com>
3Date: Tue, 31 May 2016 11:32:02 +0100
4Subject: thermal: cpu_cooling: fix improper order during initialization
5
6From: Lukasz Luba <lukasz.luba@arm.com>
7
8commit f840ab18bdf2e415dac21d09fbbbd2873111bd48 upstream.
9
10The freq_table array is not populated before calling
11thermal_of_cooling_register. The code which populates the freq table was
12introduced in commit f6859014.
13This should be done before registering new thermal cooling device.
14The log shows effects of this wrong decision.
15[ 2.172614] cpu cpu1: Failed to get voltage for frequency 1984518656000: -34
16[ 2.220863] cpu cpu0: Failed to get voltage for frequency 1984524416000: -34
17
18Fixes: f6859014c7e7 ("thermal: cpu_cooling: Store frequencies in descending order")
19Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
20Acked-by: Javi Merino <javi.merino@arm.com>
21Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
22Signed-off-by: Zhang Rui <rui.zhang@intel.com>
23Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24
25---
26 drivers/thermal/cpu_cooling.c | 16 ++++++++--------
27 1 file changed, 8 insertions(+), 8 deletions(-)
28
29--- a/drivers/thermal/cpu_cooling.c
30+++ b/drivers/thermal/cpu_cooling.c
31@@ -857,14 +857,6 @@ __cpufreq_cooling_register(struct device
32 goto free_power_table;
33 }
34
35- snprintf(dev_name, sizeof(dev_name), "thermal-cpufreq-%d",
36- cpufreq_dev->id);
37-
38- cool_dev = thermal_of_cooling_device_register(np, dev_name, cpufreq_dev,
39- &cpufreq_cooling_ops);
40- if (IS_ERR(cool_dev))
41- goto remove_idr;
42-
43 /* Fill freq-table in descending order of frequencies */
44 for (i = 0, freq = -1; i <= cpufreq_dev->max_level; i++) {
45 freq = find_next_max(table, freq);
46@@ -877,6 +869,14 @@ __cpufreq_cooling_register(struct device
47 pr_debug("%s: freq:%u KHz\n", __func__, freq);
48 }
49
50+ snprintf(dev_name, sizeof(dev_name), "thermal-cpufreq-%d",
51+ cpufreq_dev->id);
52+
53+ cool_dev = thermal_of_cooling_device_register(np, dev_name, cpufreq_dev,
54+ &cpufreq_cooling_ops);
55+ if (IS_ERR(cool_dev))
56+ goto remove_idr;
57+
58 cpufreq_dev->clipped_freq = cpufreq_dev->freq_table[0];
59 cpufreq_dev->cool_dev = cool_dev;
60