aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/cpufreq/cpufreq_stats.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index e4bd27f1a9d8..c52b44071100 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -216,7 +216,7 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy,
216 stat->time_in_state = kzalloc(alloc_size, GFP_KERNEL); 216 stat->time_in_state = kzalloc(alloc_size, GFP_KERNEL);
217 if (!stat->time_in_state) { 217 if (!stat->time_in_state) {
218 ret = -ENOMEM; 218 ret = -ENOMEM;
219 goto error_out; 219 goto error_alloc;
220 } 220 }
221 stat->freq_table = (unsigned int *)(stat->time_in_state + count); 221 stat->freq_table = (unsigned int *)(stat->time_in_state + count);
222 222
@@ -237,6 +237,8 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy,
237 stat->last_index = freq_table_get_index(stat, policy->cur); 237 stat->last_index = freq_table_get_index(stat, policy->cur);
238 spin_unlock(&cpufreq_stats_lock); 238 spin_unlock(&cpufreq_stats_lock);
239 return 0; 239 return 0;
240error_alloc:
241 sysfs_remove_group(&policy->kobj, &stats_attr_group);
240error_out: 242error_out:
241 kfree(stat); 243 kfree(stat);
242 per_cpu(cpufreq_stats_table, cpu) = NULL; 244 per_cpu(cpufreq_stats_table, cpu) = NULL;