summaryrefslogtreecommitdiff
path: root/drivers/cpufreq/cpufreq_stats.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2015-01-06 21:09:12 +0530
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-01-23 23:06:44 +0100
commitc960f9b22d63934401949fb20d10ec4e69b535b2 (patch)
tree070d80ff5d0d50cb3297f254f6d60fd2317238e2 /drivers/cpufreq/cpufreq_stats.c
parenta685c6d023c77303ca8700f37bf06eb85ffbf06a (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/cpufreq_stats.c')
-rw-r--r--drivers/cpufreq/cpufreq_stats.c4
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)
unsigned long long cur_time = get_jiffies_64();
spin_lock(&cpufreq_stats_lock);
- if (stats->time_in_state)
- stats->time_in_state[stats->last_index] +=
- cur_time - stats->last_time;
+ stats->time_in_state[stats->last_index] += cur_time - stats->last_time;
stats->last_time = cur_time;
spin_unlock(&cpufreq_stats_lock);
return 0;