Skip to content

Commit

Permalink
cpufreq: stats: time_in_state can't be NULL in cpufreq_stats_update()
Browse files Browse the repository at this point in the history
'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>
  • Loading branch information
Viresh Kumar authored and Rafael J. Wysocki committed Jan 23, 2015
1 parent a685c6d commit c960f9b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/cpufreq/cpufreq_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c960f9b

Please sign in to comment.