diff options
author | Zhang Rui <rui.zhang@intel.com> | 2017-07-05 14:51:32 +0800 |
---|---|---|
committer | Zhang Rui <rui.zhang@intel.com> | 2017-07-05 14:51:32 +0800 |
commit | 467aebee872af7f5e703809e19a66de633a1aa2c (patch) | |
tree | 21a80e16c5e7a3c1d34c60fb6f6274eb9e6c1347 /drivers/cpufreq/cpufreq_stats.c | |
parent | c0bc126f97fb929b3ae02c1c62322645d70eb408 (diff) | |
parent | 1fe3854a83b580727c9464b37b62ba77ead1d6f6 (diff) | |
download | linux-stable-467aebee872af7f5e703809e19a66de633a1aa2c.tar.gz |
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal into thermal-soc
Diffstat (limited to 'drivers/cpufreq/cpufreq_stats.c')
-rw-r--r-- | drivers/cpufreq/cpufreq_stats.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index f570ead62454..9c3d319dc129 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c @@ -170,11 +170,10 @@ void cpufreq_stats_create_table(struct cpufreq_policy *policy) unsigned int i = 0, count = 0, ret = -ENOMEM; struct cpufreq_stats *stats; unsigned int alloc_size; - struct cpufreq_frequency_table *pos, *table; + struct cpufreq_frequency_table *pos; - /* We need cpufreq table for creating stats table */ - table = policy->freq_table; - if (unlikely(!table)) + count = cpufreq_table_count_valid_entries(policy); + if (!count) return; /* stats already initialized */ @@ -185,10 +184,6 @@ void cpufreq_stats_create_table(struct cpufreq_policy *policy) if (!stats) return; - /* Find total allocation size */ - cpufreq_for_each_valid_entry(pos, table) - count++; - alloc_size = count * sizeof(int) + count * sizeof(u64); alloc_size += count * count * sizeof(int); @@ -205,7 +200,7 @@ void cpufreq_stats_create_table(struct cpufreq_policy *policy) stats->max_state = count; /* Find valid-unique entries */ - cpufreq_for_each_valid_entry(pos, table) + cpufreq_for_each_valid_entry(pos, policy->freq_table) if (freq_table_get_index(stats, pos->frequency) == -1) stats->freq_table[i++] = pos->frequency; |