Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 309cd2c0 authored by Kevin Hilman's avatar Kevin Hilman
Browse files

cpufreq_stats: fix use of cpufreq_for_each_valid_entry() iterator



commit 7f53705d (cpufreq_stats: Adds the fucntionality to load
current values for each frequency for all the cores) introduces a
subtle bug in the use of the cpufreq_for_each_valid_entry() iterator.

For example, there are two occasions of this:

	cpufreq_for_each_valid_entry(pos, table);
		count++;

which has a stray ';' after the iterator, meaning that 'count++' is
always executed.

I found this when debugging a crash on an exynos5250-arndale platform, where
the cpufreq_stats driver was crashing during boot.

Change-Id: I9977f395d5b2e26134fc9d379b12197b73ec62e4
Cc: Ruchi Kandoi <kandoiruchi@google.com>
Signed-off-by: default avatarKevin Hilman <khilman@linaro.org>
parent f73aa0ea
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -577,7 +577,7 @@ static void cpufreq_stats_create_table(unsigned int cpu)

	table = cpufreq_frequency_get_table(policy->cpu);
	if (likely(table)) {
		cpufreq_for_each_valid_entry(pos, table);
		cpufreq_for_each_valid_entry(pos, table)
			count++;

		if (!per_cpu(all_cpufreq_stats, cpu))
@@ -608,7 +608,7 @@ static int cpufreq_stat_notifier_policy(struct notifier_block *nb,
	if (!table)
		return 0;

	cpufreq_for_each_valid_entry(pos, table);
	cpufreq_for_each_valid_entry(pos, table)
		count++;

	if (!per_cpu(all_cpufreq_stats, cpu))