From: Huang, Tao Date: Sat, 21 Mar 2015 07:54:17 +0000 (+0800) Subject: cpufreq: cpufreq_stats: prevent last_index = -1 X-Git-Tag: firefly_0821_release~4158^2~322 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=bb53d4bb3c15f114b028ecdce764b028d1c640f8;p=firefly-linux-kernel-4.4.55.git cpufreq: cpufreq_stats: prevent last_index = -1 Signed-off-by: Huang, Tao --- diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index 04570b2d63d1..0073ef4eb146 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c @@ -368,6 +368,10 @@ static int cpufreq_stats_create_table(struct cpufreq_policy *policy, spin_lock(&cpufreq_stats_lock); stat->last_time = get_jiffies_64(); stat->last_index = freq_table_get_index(stat, policy->cur); +#ifdef CONFIG_ARCH_ROCKCHIP + if (stat->last_index == -1) + stat->last_index = 0; +#endif spin_unlock(&cpufreq_stats_lock); cpufreq_cpu_put(data); return 0; @@ -537,10 +541,6 @@ static int cpufreq_stat_notifier_trans(struct notifier_block *nb, old_index = stat->last_index; new_index = freq_table_get_index(stat, freq->new); -#ifdef CONFIG_ARCH_ROCKCHIP - if (old_index == -1) - stat->last_index = new_index; -#endif /* We can't do stat->time_in_state[-1]= .. */ if (old_index == -1 || new_index == -1) return 0;