diff options
author | Saravana Kannan <skannan@codeaurora.org> | 2014-02-27 17:58:35 -0800 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-03-02 00:55:50 +0100 |
commit | 0b7528d963e7dda51dd07fa7b1f14a9bf03b1cee (patch) | |
tree | 16d427ae0e874123cf1e30315da3142a3313cd2a /drivers/cpufreq | |
parent | b24a5b6512a6fb89f3b99b9b0f829b4448e62db0 (diff) |
cpufreq: stats: Fix error handling in __cpufreq_stats_create_table()
Remove sysfs group if __cpufreq_stats_create_table() fails after creating
one.
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Saravana Kannan <skannan@codeaurora.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, 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, stat->time_in_state = kzalloc(alloc_size, GFP_KERNEL); if (!stat->time_in_state) { ret = -ENOMEM; - goto error_out; + goto error_alloc; } stat->freq_table = (unsigned int *)(stat->time_in_state + count); @@ -237,6 +237,8 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy, stat->last_index = freq_table_get_index(stat, policy->cur); spin_unlock(&cpufreq_stats_lock); return 0; +error_alloc: + sysfs_remove_group(&policy->kobj, &stats_attr_group); error_out: kfree(stat); per_cpu(cpufreq_stats_table, cpu) = NULL; |