diff options
Diffstat (limited to 'drivers/cpufreq/cpufreq_stats.c')
-rw-r--r-- | drivers/cpufreq/cpufreq_stats.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index 741b6b191e6a..ff16a87125d9 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c | |||
@@ -192,9 +192,8 @@ cpufreq_stats_create_table (struct cpufreq_policy *policy, | |||
192 | unsigned int cpu = policy->cpu; | 192 | unsigned int cpu = policy->cpu; |
193 | if (cpufreq_stats_table[cpu]) | 193 | if (cpufreq_stats_table[cpu]) |
194 | return -EBUSY; | 194 | return -EBUSY; |
195 | if ((stat = kmalloc(sizeof(struct cpufreq_stats), GFP_KERNEL)) == NULL) | 195 | if ((stat = kzalloc(sizeof(struct cpufreq_stats), GFP_KERNEL)) == NULL) |
196 | return -ENOMEM; | 196 | return -ENOMEM; |
197 | memset(stat, 0, sizeof (struct cpufreq_stats)); | ||
198 | 197 | ||
199 | data = cpufreq_cpu_get(cpu); | 198 | data = cpufreq_cpu_get(cpu); |
200 | if ((ret = sysfs_create_group(&data->kobj, &stats_attr_group))) | 199 | if ((ret = sysfs_create_group(&data->kobj, &stats_attr_group))) |
@@ -216,12 +215,11 @@ cpufreq_stats_create_table (struct cpufreq_policy *policy, | |||
216 | alloc_size += count * count * sizeof(int); | 215 | alloc_size += count * count * sizeof(int); |
217 | #endif | 216 | #endif |
218 | stat->max_state = count; | 217 | stat->max_state = count; |
219 | stat->time_in_state = kmalloc(alloc_size, GFP_KERNEL); | 218 | stat->time_in_state = kzalloc(alloc_size, GFP_KERNEL); |
220 | if (!stat->time_in_state) { | 219 | if (!stat->time_in_state) { |
221 | ret = -ENOMEM; | 220 | ret = -ENOMEM; |
222 | goto error_out; | 221 | goto error_out; |
223 | } | 222 | } |
224 | memset(stat->time_in_state, 0, alloc_size); | ||
225 | stat->freq_table = (unsigned int *)(stat->time_in_state + count); | 223 | stat->freq_table = (unsigned int *)(stat->time_in_state + count); |
226 | 224 | ||
227 | #ifdef CONFIG_CPU_FREQ_STAT_DETAILS | 225 | #ifdef CONFIG_CPU_FREQ_STAT_DETAILS |