diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2015-01-06 10:39:12 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-01-23 17:06:44 -0500 |
commit | c960f9b22d63934401949fb20d10ec4e69b535b2 (patch) | |
tree | 070d80ff5d0d50cb3297f254f6d60fd2317238e2 /drivers/cpufreq | |
parent | a685c6d023c77303ca8700f37bf06eb85ffbf06a (diff) |
cpufreq: stats: time_in_state can't be NULL in cpufreq_stats_update()
'time_in_state' can't be NULL if 'stats' is valid. These are allocated together
and only if time_in_state is allocated successfully, we update policy->stats.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/cpufreq_stats.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index 5d7bf9b1dfc5..a9a6dc479adf 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c | |||
@@ -35,9 +35,7 @@ static int cpufreq_stats_update(struct cpufreq_stats *stats) | |||
35 | unsigned long long cur_time = get_jiffies_64(); | 35 | unsigned long long cur_time = get_jiffies_64(); |
36 | 36 | ||
37 | spin_lock(&cpufreq_stats_lock); | 37 | spin_lock(&cpufreq_stats_lock); |
38 | if (stats->time_in_state) | 38 | stats->time_in_state[stats->last_index] += cur_time - stats->last_time; |
39 | stats->time_in_state[stats->last_index] += | ||
40 | cur_time - stats->last_time; | ||
41 | stats->last_time = cur_time; | 39 | stats->last_time = cur_time; |
42 | spin_unlock(&cpufreq_stats_lock); | 40 | spin_unlock(&cpufreq_stats_lock); |
43 | return 0; | 41 | return 0; |