diff options
author | Burman Yan <yan_952@hotmail.com> | 2006-12-06 20:14:19 -0500 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2006-12-06 20:14:19 -0500 |
commit | 116780fc04d9f6cd3ceeab0251681f1dfda53367 (patch) | |
tree | d28148b520fa9ed8e7ea7d6e067c95cee4a42078 /arch/i386 | |
parent | d7fb02712818643bab79a6b3cb8270a747d0227b (diff) |
[PATCH] i386: replace kmalloc+memset with kzalloc
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'arch/i386')
-rw-r--r-- | arch/i386/kernel/cpu/intel_cacheinfo.c | 11 | ||||
-rw-r--r-- | arch/i386/kernel/mca.c | 13 | ||||
-rw-r--r-- | arch/i386/kernel/pci-dma.c | 6 | ||||
-rw-r--r-- | arch/i386/mach-voyager/voyager_cat.c | 6 |
4 files changed, 11 insertions, 25 deletions
diff --git a/arch/i386/kernel/cpu/intel_cacheinfo.c b/arch/i386/kernel/cpu/intel_cacheinfo.c index 5c43be47587f..80b4c5d421b1 100644 --- a/arch/i386/kernel/cpu/intel_cacheinfo.c +++ b/arch/i386/kernel/cpu/intel_cacheinfo.c | |||
@@ -480,12 +480,10 @@ static int __cpuinit detect_cache_attributes(unsigned int cpu) | |||
480 | if (num_cache_leaves == 0) | 480 | if (num_cache_leaves == 0) |
481 | return -ENOENT; | 481 | return -ENOENT; |
482 | 482 | ||
483 | cpuid4_info[cpu] = kmalloc( | 483 | cpuid4_info[cpu] = kzalloc( |
484 | sizeof(struct _cpuid4_info) * num_cache_leaves, GFP_KERNEL); | 484 | sizeof(struct _cpuid4_info) * num_cache_leaves, GFP_KERNEL); |
485 | if (unlikely(cpuid4_info[cpu] == NULL)) | 485 | if (unlikely(cpuid4_info[cpu] == NULL)) |
486 | return -ENOMEM; | 486 | return -ENOMEM; |
487 | memset(cpuid4_info[cpu], 0, | ||
488 | sizeof(struct _cpuid4_info) * num_cache_leaves); | ||
489 | 487 | ||
490 | oldmask = current->cpus_allowed; | 488 | oldmask = current->cpus_allowed; |
491 | retval = set_cpus_allowed(current, cpumask_of_cpu(cpu)); | 489 | retval = set_cpus_allowed(current, cpumask_of_cpu(cpu)); |
@@ -658,17 +656,14 @@ static int __cpuinit cpuid4_cache_sysfs_init(unsigned int cpu) | |||
658 | return -ENOENT; | 656 | return -ENOENT; |
659 | 657 | ||
660 | /* Allocate all required memory */ | 658 | /* Allocate all required memory */ |
661 | cache_kobject[cpu] = kmalloc(sizeof(struct kobject), GFP_KERNEL); | 659 | cache_kobject[cpu] = kzalloc(sizeof(struct kobject), GFP_KERNEL); |
662 | if (unlikely(cache_kobject[cpu] == NULL)) | 660 | if (unlikely(cache_kobject[cpu] == NULL)) |
663 | goto err_out; | 661 | goto err_out; |
664 | memset(cache_kobject[cpu], 0, sizeof(struct kobject)); | ||
665 | 662 | ||
666 | index_kobject[cpu] = kmalloc( | 663 | index_kobject[cpu] = kzalloc( |
667 | sizeof(struct _index_kobject ) * num_cache_leaves, GFP_KERNEL); | 664 | sizeof(struct _index_kobject ) * num_cache_leaves, GFP_KERNEL); |
668 | if (unlikely(index_kobject[cpu] == NULL)) | 665 | if (unlikely(index_kobject[cpu] == NULL)) |
669 | goto err_out; | 666 | goto err_out; |
670 | memset(index_kobject[cpu], 0, | ||
671 | sizeof(struct _index_kobject) * num_cache_leaves); | ||
672 | 667 | ||
673 | return 0; | 668 | return 0; |
674 | 669 | ||
diff --git a/arch/i386/kernel/mca.c b/arch/i386/kernel/mca.c index eb57a851789d..b83672b89527 100644 --- a/arch/i386/kernel/mca.c +++ b/arch/i386/kernel/mca.c | |||
@@ -283,10 +283,9 @@ static int __init mca_init(void) | |||
283 | bus->f.mca_transform_memory = mca_dummy_transform_memory; | 283 | bus->f.mca_transform_memory = mca_dummy_transform_memory; |
284 | 284 | ||
285 | /* get the motherboard device */ | 285 | /* get the motherboard device */ |
286 | mca_dev = kmalloc(sizeof(struct mca_device), GFP_KERNEL); | 286 | mca_dev = kzalloc(sizeof(struct mca_device), GFP_KERNEL); |
287 | if(unlikely(!mca_dev)) | 287 | if(unlikely(!mca_dev)) |
288 | goto out_nomem; | 288 | goto out_nomem; |
289 | memset(mca_dev, 0, sizeof(struct mca_device)); | ||
290 | 289 | ||
291 | /* | 290 | /* |
292 | * We do not expect many MCA interrupts during initialization, | 291 | * We do not expect many MCA interrupts during initialization, |
@@ -310,11 +309,9 @@ static int __init mca_init(void) | |||
310 | mca_dev->slot = MCA_MOTHERBOARD; | 309 | mca_dev->slot = MCA_MOTHERBOARD; |
311 | mca_register_device(MCA_PRIMARY_BUS, mca_dev); | 310 | mca_register_device(MCA_PRIMARY_BUS, mca_dev); |
312 | 311 | ||
313 | mca_dev = kmalloc(sizeof(struct mca_device), GFP_ATOMIC); | 312 | mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC); |
314 | if(unlikely(!mca_dev)) | 313 | if(unlikely(!mca_dev)) |
315 | goto out_unlock_nomem; | 314 | goto out_unlock_nomem; |
316 | memset(mca_dev, 0, sizeof(struct mca_device)); | ||
317 | |||
318 | 315 | ||
319 | /* Put motherboard into video setup mode, read integrated video | 316 | /* Put motherboard into video setup mode, read integrated video |
320 | * POS registers, and turn motherboard setup off. | 317 | * POS registers, and turn motherboard setup off. |
@@ -349,10 +346,9 @@ static int __init mca_init(void) | |||
349 | } | 346 | } |
350 | if(which_scsi) { | 347 | if(which_scsi) { |
351 | /* found a scsi card */ | 348 | /* found a scsi card */ |
352 | mca_dev = kmalloc(sizeof(struct mca_device), GFP_ATOMIC); | 349 | mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC); |
353 | if(unlikely(!mca_dev)) | 350 | if(unlikely(!mca_dev)) |
354 | goto out_unlock_nomem; | 351 | goto out_unlock_nomem; |
355 | memset(mca_dev, 0, sizeof(struct mca_device)); | ||
356 | 352 | ||
357 | for(j = 0; j < 8; j++) | 353 | for(j = 0; j < 8; j++) |
358 | mca_dev->pos[j] = pos[j]; | 354 | mca_dev->pos[j] = pos[j]; |
@@ -378,10 +374,9 @@ static int __init mca_init(void) | |||
378 | if(!mca_read_and_store_pos(pos)) | 374 | if(!mca_read_and_store_pos(pos)) |
379 | continue; | 375 | continue; |
380 | 376 | ||
381 | mca_dev = kmalloc(sizeof(struct mca_device), GFP_ATOMIC); | 377 | mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC); |
382 | if(unlikely(!mca_dev)) | 378 | if(unlikely(!mca_dev)) |
383 | goto out_unlock_nomem; | 379 | goto out_unlock_nomem; |
384 | memset(mca_dev, 0, sizeof(struct mca_device)); | ||
385 | 380 | ||
386 | for(j=0; j<8; j++) | 381 | for(j=0; j<8; j++) |
387 | mca_dev->pos[j]=pos[j]; | 382 | mca_dev->pos[j]=pos[j]; |
diff --git a/arch/i386/kernel/pci-dma.c b/arch/i386/kernel/pci-dma.c index 5c8c6ef1fc5e..41af692c1584 100644 --- a/arch/i386/kernel/pci-dma.c +++ b/arch/i386/kernel/pci-dma.c | |||
@@ -92,14 +92,12 @@ int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr, | |||
92 | if (!mem_base) | 92 | if (!mem_base) |
93 | goto out; | 93 | goto out; |
94 | 94 | ||
95 | dev->dma_mem = kmalloc(sizeof(struct dma_coherent_mem), GFP_KERNEL); | 95 | dev->dma_mem = kzalloc(sizeof(struct dma_coherent_mem), GFP_KERNEL); |
96 | if (!dev->dma_mem) | 96 | if (!dev->dma_mem) |
97 | goto out; | 97 | goto out; |
98 | memset(dev->dma_mem, 0, sizeof(struct dma_coherent_mem)); | 98 | dev->dma_mem->bitmap = kzalloc(bitmap_size, GFP_KERNEL); |
99 | dev->dma_mem->bitmap = kmalloc(bitmap_size, GFP_KERNEL); | ||
100 | if (!dev->dma_mem->bitmap) | 99 | if (!dev->dma_mem->bitmap) |
101 | goto free1_out; | 100 | goto free1_out; |
102 | memset(dev->dma_mem->bitmap, 0, bitmap_size); | ||
103 | 101 | ||
104 | dev->dma_mem->virt_base = mem_base; | 102 | dev->dma_mem->virt_base = mem_base; |
105 | dev->dma_mem->device_base = device_addr; | 103 | dev->dma_mem->device_base = device_addr; |
diff --git a/arch/i386/mach-voyager/voyager_cat.c b/arch/i386/mach-voyager/voyager_cat.c index f50c6c6ad680..943a9473b138 100644 --- a/arch/i386/mach-voyager/voyager_cat.c +++ b/arch/i386/mach-voyager/voyager_cat.c | |||
@@ -776,7 +776,7 @@ voyager_cat_init(void) | |||
776 | for(asic=0; asic < (*modpp)->num_asics; asic++) { | 776 | for(asic=0; asic < (*modpp)->num_asics; asic++) { |
777 | int j; | 777 | int j; |
778 | voyager_asic_t *asicp = *asicpp | 778 | voyager_asic_t *asicp = *asicpp |
779 | = kmalloc(sizeof(voyager_asic_t), GFP_KERNEL); /*&voyager_asic_storage[asic_count++];*/ | 779 | = kzalloc(sizeof(voyager_asic_t), GFP_KERNEL); /*&voyager_asic_storage[asic_count++];*/ |
780 | voyager_sp_table_t *sp_table; | 780 | voyager_sp_table_t *sp_table; |
781 | voyager_at_t *asic_table; | 781 | voyager_at_t *asic_table; |
782 | voyager_jtt_t *jtag_table; | 782 | voyager_jtt_t *jtag_table; |
@@ -785,7 +785,6 @@ voyager_cat_init(void) | |||
785 | printk("**WARNING** kmalloc failure in cat_init\n"); | 785 | printk("**WARNING** kmalloc failure in cat_init\n"); |
786 | continue; | 786 | continue; |
787 | } | 787 | } |
788 | memset(asicp, 0, sizeof(voyager_asic_t)); | ||
789 | asicpp = &(asicp->next); | 788 | asicpp = &(asicp->next); |
790 | asicp->asic_location = asic; | 789 | asicp->asic_location = asic; |
791 | sp_table = (voyager_sp_table_t *)(eprom_buf + sp_offset); | 790 | sp_table = (voyager_sp_table_t *)(eprom_buf + sp_offset); |
@@ -851,8 +850,7 @@ voyager_cat_init(void) | |||
851 | #endif | 850 | #endif |
852 | 851 | ||
853 | { | 852 | { |
854 | struct resource *res = kmalloc(sizeof(struct resource),GFP_KERNEL); | 853 | struct resource *res = kzalloc(sizeof(struct resource),GFP_KERNEL); |
855 | memset(res, 0, sizeof(struct resource)); | ||
856 | res->name = kmalloc(128, GFP_KERNEL); | 854 | res->name = kmalloc(128, GFP_KERNEL); |
857 | sprintf((char *)res->name, "Voyager %s Quad CPI", cat_module_name(i)); | 855 | sprintf((char *)res->name, "Voyager %s Quad CPI", cat_module_name(i)); |
858 | res->start = qic_addr; | 856 | res->start = qic_addr; |