diff options
author | Dave Jones <davej@redhat.com> | 2005-10-20 18:17:43 -0400 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2005-10-20 18:17:43 -0400 |
commit | e98df50c5200ae3c748d69002a8827afc9d2eae2 (patch) | |
tree | 885c86b8b573d22176435b51f146bc6177acc13c /drivers/cpufreq | |
parent | bfdc708dc7d26fca66df0157b36356a2ba6166eb (diff) |
[CPUFREQ] kzalloc conversions for cpufreq core.
Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 3 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_stats.c | 6 |
2 files changed, 3 insertions, 6 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 109d62ccf651..cfe1d0a2262d 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -595,12 +595,11 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) | |||
595 | goto module_out; | 595 | goto module_out; |
596 | } | 596 | } |
597 | 597 | ||
598 | policy = kmalloc(sizeof(struct cpufreq_policy), GFP_KERNEL); | 598 | policy = kzalloc(sizeof(struct cpufreq_policy), GFP_KERNEL); |
599 | if (!policy) { | 599 | if (!policy) { |
600 | ret = -ENOMEM; | 600 | ret = -ENOMEM; |
601 | goto nomem_out; | 601 | goto nomem_out; |
602 | } | 602 | } |
603 | memset(policy, 0, sizeof(struct cpufreq_policy)); | ||
604 | 603 | ||
605 | policy->cpu = cpu; | 604 | policy->cpu = cpu; |
606 | policy->cpus = cpumask_of_cpu(cpu); | 605 | policy->cpus = cpumask_of_cpu(cpu); |
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 |