diff options
author | Jan Beulich <jbeulich@suse.com> | 2011-10-04 14:17:28 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2011-10-04 14:17:28 +0200 |
commit | 91f47f155288b0116472a7ce64d8709f144a5357 (patch) | |
tree | 761fae4d9a2dbe8bd8de4b9dbace20fcc1d40b74 /xen/drivers/cpufreq | |
parent | cef3d6c06771651b20504357379c3ad53d7673cd (diff) | |
download | xen-91f47f155288b0116472a7ce64d8709f144a5357.tar.gz xen-91f47f155288b0116472a7ce64d8709f144a5357.tar.bz2 xen-91f47f155288b0116472a7ce64d8709f144a5357.zip |
use xzalloc in driver code
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/drivers/cpufreq')
-rw-r--r-- | xen/drivers/cpufreq/cpufreq.c | 9 | ||||
-rw-r--r-- | xen/drivers/cpufreq/utility.c | 10 |
2 files changed, 6 insertions, 13 deletions
diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c index a44a444580..cf36de8011 100644 --- a/xen/drivers/cpufreq/cpufreq.c +++ b/xen/drivers/cpufreq/cpufreq.c @@ -148,11 +148,10 @@ int cpufreq_add_cpu(unsigned int cpu) } if (!domexist) { - cpufreq_dom = xmalloc(struct cpufreq_dom); + cpufreq_dom = xzalloc(struct cpufreq_dom); if (!cpufreq_dom) return -ENOMEM; - memset(cpufreq_dom, 0, sizeof(struct cpufreq_dom)); cpufreq_dom->dom = dom; list_add(&cpufreq_dom->node, &cpufreq_dom_list_head); } else { @@ -176,11 +175,10 @@ int cpufreq_add_cpu(unsigned int cpu) } if (!domexist || hw_all) { - policy = xmalloc(struct cpufreq_policy); + policy = xzalloc(struct cpufreq_policy); if (!policy) ret = -ENOMEM; - memset(policy, 0, sizeof(struct cpufreq_policy)); policy->cpu = cpu; per_cpu(cpufreq_cpu_policy, cpu) = policy; @@ -374,13 +372,12 @@ int set_px_pminfo(uint32_t acpi_id, struct xen_processor_performance *dom0_px_in pmpt = processor_pminfo[cpuid]; if ( !pmpt ) { - pmpt = xmalloc(struct processor_pminfo); + pmpt = xzalloc(struct processor_pminfo); if ( !pmpt ) { ret = -ENOMEM; goto out; } - memset(pmpt, 0, sizeof(*pmpt)); processor_pminfo[cpuid] = pmpt; } pxpt = &pmpt->perf; diff --git a/xen/drivers/cpufreq/utility.c b/xen/drivers/cpufreq/utility.c index 8fb349246e..800438d136 100644 --- a/xen/drivers/cpufreq/utility.c +++ b/xen/drivers/cpufreq/utility.c @@ -110,22 +110,21 @@ int cpufreq_statistic_init(unsigned int cpuid) count = pmpt->perf.state_count; - pxpt = xmalloc(struct pm_px); + pxpt = xzalloc(struct pm_px); if ( !pxpt ) { spin_unlock(cpufreq_statistic_lock); return -ENOMEM; } - memset(pxpt, 0, sizeof(*pxpt)); per_cpu(cpufreq_statistic_data, cpuid) = pxpt; - pxpt->u.trans_pt = xmalloc_array(uint64_t, count * count); + pxpt->u.trans_pt = xzalloc_array(uint64_t, count * count); if (!pxpt->u.trans_pt) { xfree(pxpt); spin_unlock(cpufreq_statistic_lock); return -ENOMEM; } - pxpt->u.pt = xmalloc_array(struct pm_px_val, count); + pxpt->u.pt = xzalloc_array(struct pm_px_val, count); if (!pxpt->u.pt) { xfree(pxpt->u.trans_pt); xfree(pxpt); @@ -133,9 +132,6 @@ int cpufreq_statistic_init(unsigned int cpuid) return -ENOMEM; } - memset(pxpt->u.trans_pt, 0, count * count * (sizeof(uint64_t))); - memset(pxpt->u.pt, 0, count * (sizeof(struct pm_px_val))); - pxpt->u.total = pmpt->perf.state_count; pxpt->u.usable = pmpt->perf.state_count - pmpt->perf.platform_limit; |