aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/cpufreq/cpufreq_stats.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index 5793e1447fb1..e4bd27f1a9d8 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -185,7 +185,6 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy,
185{ 185{
186 unsigned int i, j, count = 0, ret = 0; 186 unsigned int i, j, count = 0, ret = 0;
187 struct cpufreq_stats *stat; 187 struct cpufreq_stats *stat;
188 struct cpufreq_policy *current_policy;
189 unsigned int alloc_size; 188 unsigned int alloc_size;
190 unsigned int cpu = policy->cpu; 189 unsigned int cpu = policy->cpu;
191 if (per_cpu(cpufreq_stats_table, cpu)) 190 if (per_cpu(cpufreq_stats_table, cpu))
@@ -194,13 +193,7 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy,
194 if ((stat) == NULL) 193 if ((stat) == NULL)
195 return -ENOMEM; 194 return -ENOMEM;
196 195
197 current_policy = cpufreq_cpu_get(cpu); 196 ret = sysfs_create_group(&policy->kobj, &stats_attr_group);
198 if (current_policy == NULL) {
199 ret = -EINVAL;
200 goto error_get_fail;
201 }
202
203 ret = sysfs_create_group(&current_policy->kobj, &stats_attr_group);
204 if (ret) 197 if (ret)
205 goto error_out; 198 goto error_out;
206 199
@@ -243,11 +236,8 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy,
243 stat->last_time = get_jiffies_64(); 236 stat->last_time = get_jiffies_64();
244 stat->last_index = freq_table_get_index(stat, policy->cur); 237 stat->last_index = freq_table_get_index(stat, policy->cur);
245 spin_unlock(&cpufreq_stats_lock); 238 spin_unlock(&cpufreq_stats_lock);
246 cpufreq_cpu_put(current_policy);
247 return 0; 239 return 0;
248error_out: 240error_out:
249 cpufreq_cpu_put(current_policy);
250error_get_fail:
251 kfree(stat); 241 kfree(stat);
252 per_cpu(cpufreq_stats_table, cpu) = NULL; 242 per_cpu(cpufreq_stats_table, cpu) = NULL;
253 return ret; 243 return ret;