thermal: exynos: fix handling of invalid frequency table entries
Subsystems (2)
PATCH 1/1 thermal: exynos: fix handling of invalid frequency table entries
Similar to the error described in "thermal: cpu_cooling: fix handling of invalid frequency table entries," exynos_get_frequency_level() will enter an infinite loop if any CPU frequency table entries are invalid. This patch fixes the handling of invalid frequency entries so that there is no infinite loop and the correct level is returned.
--- drivers/thermal/exynos_thermal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/thermal/exynos_thermal.c +4 -4
@@ -237,7 +237,7 @@ static int exynos_get_crit_temp(struct thermal_zone_device *thermal,static int exynos_get_frequency_level (unsigned int cpu,unsigned int freq) { -int i =0 , ret = -EINVAL ; +int i, level =0 , ret = -EINVAL ;struct cpufreq_frequency_table *table =NULL ;#ifdef CONFIG_CPU_FREQ table =cpufreq_frequency_get_table (cpu);
@@ -245,12 +245,12 @@ static int exynos_get_frequency_level(unsigned int cpu, unsigned int freq)if (!table)return ret; -while (table[i].frequency !=CPUFREQ_TABLE_END ) { +for (i =0 ; table[i].frequency !=CPUFREQ_TABLE_END ; i++) {if (table[i].frequency ==CPUFREQ_ENTRY_INVALID )continue ;if (table[i].frequency == freq) -return i; - i++; +return level; + level++; }return ret; }
Signature · 1 line
1.8.1.3
Zhang Rui
reviewerHi, Andrew,
can you please verify
commit fc35b35cbe24ef021ea9acfba21e54da958df747
commit 57df8106932b57427df1eaaa13871857f75b1194
at
http://git.kernel.org/cgit/linux/kernel/git/rzhang/linux.git/log/?h=thermal
fixes the problem for you?
thanks,
rui
Quoted 40 lines · Andrew Bresticker
Similar to the error described in "thermal:
cpu_cooling: fix handling of invalid frequency table entries,"exynos_get_frequency_level()will enter an infinite loop if any CPU frequency table entries are invalid. This patch fixes the handling of invalid frequency entries so that there is no infinite loop and the correct level is returned.Signed-off-by Andrew Bresticker <[email protected]>--- drivers/thermal/exynos_thermal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/thermal/exynos_thermal.c +4
-4@@ -237,7 +237,7 @@ static int exynos_get_crit_temp(struct thermal_zone_device *thermal,static int exynos_get_frequency_level (unsigned int cpu,unsigned int freq) { -int i =0 , ret = -EINVAL ; +int i, level =0 , ret = -EINVAL ;struct cpufreq_frequency_table *table =NULL ;#ifdef CONFIG_CPU_FREQ table =cpufreq_frequency_get_table (cpu);@@ -245,12 +245,12 @@ static int exynos_get_frequency_level(unsigned int cpu, unsigned int freq)if (!table)return ret; -while (table[i].frequency !=CPUFREQ_TABLE_END ) { +for (i =0 ; table[i].frequency !=CPUFREQ_TABLE_END ; i++) {if (table[i].frequency ==CPUFREQ_ENTRY_INVALID )continue ;if (table[i].frequency == freq) -return i; - i++; +return level; + level++; }return ret; }
Quoted 6 lines
can you please verify
commitfc35b35cbe24ef021ea9acfba21e54da958df747
commit57df8106932b57427df1eaaa13871857f75b1194
at
http://git.kernel.org/cgit/linux/kernel/git/rzhang/linux.git/log/?h=thermal
fixes the problem for you?
It does. Thanks!
-Andrew