* [KJ] [Patch] kzalloc() conversion in arch/ia64
@ 2006-03-04 19:09 Eric Sesterhenn
2006-03-04 19:09 ` [KJ] [Patch] kzalloc() conversion in arch/i386 Eric Sesterhenn
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: Eric Sesterhenn @ 2006-03-04 19:09 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 4818 bytes --]
hi,
this patch converts arch/ia64 to kzalloc usage.
Not tested.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.16-rc5-mm1/arch/ia64/kernel/perfmon.c.orig 2006-03-04 19:36:05.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/ia64/kernel/perfmon.c 2006-03-04 19:36:28.000000000 +0100
@@ -847,11 +847,9 @@ pfm_context_alloc(void)
* allocate context descriptor
* must be able to free with interrupts disabled
*/
- ctx = kmalloc(sizeof(pfm_context_t), GFP_KERNEL);
- if (ctx) {
- memset(ctx, 0, sizeof(pfm_context_t));
+ ctx = kzalloc(sizeof(pfm_context_t), GFP_KERNEL);
+ if (ctx)
DPRINT(("alloc ctx @%p\n", ctx));
- }
return ctx;
}
--- linux-2.6.16-rc5-mm1/arch/ia64/kernel/cpufreq/acpi-cpufreq.c.orig 2006-03-04 19:36:37.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/ia64/kernel/cpufreq/acpi-cpufreq.c 2006-03-04 19:36:47.000000000 +0100
@@ -280,12 +280,10 @@ acpi_cpufreq_cpu_init (
dprintk("acpi_cpufreq_cpu_init\n");
- data = kmalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL);
+ data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL);
if (!data)
return (-ENOMEM);
- memset(data, 0, sizeof(struct cpufreq_acpi_io));
-
acpi_io_data[cpu] = data;
result = acpi_processor_register_performance(&data->acpi_data, cpu);
--- linux-2.6.16-rc5-mm1/arch/ia64/hp/sim/simserial.c.orig 2006-03-04 19:37:02.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/ia64/hp/sim/simserial.c 2006-03-04 19:37:12.000000000 +0100
@@ -685,12 +685,11 @@ static int get_async_struct(int line, st
*ret_info = sstate->info;
return 0;
}
- info = kmalloc(sizeof(struct async_struct), GFP_KERNEL);
+ info = kzalloc(sizeof(struct async_struct), GFP_KERNEL);
if (!info) {
sstate->count--;
return -ENOMEM;
}
- memset(info, 0, sizeof(struct async_struct));
init_waitqueue_head(&info->open_wait);
init_waitqueue_head(&info->close_wait);
init_waitqueue_head(&info->delta_msr_wait);
--- linux-2.6.16-rc5-mm1/arch/ia64/hp/common/sba_iommu.c.orig 2006-03-04 19:37:21.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/ia64/hp/common/sba_iommu.c 2006-03-04 19:37:56.000000000 +0100
@@ -1673,15 +1673,13 @@ ioc_sac_init(struct ioc *ioc)
* SAC (single address cycle) addressable, so allocate a
* pseudo-device to enforce that.
*/
- sac = kmalloc(sizeof(*sac), GFP_KERNEL);
+ sac = kzalloc(sizeof(*sac), GFP_KERNEL);
if (!sac)
panic(PFX "Couldn't allocate struct pci_dev");
- memset(sac, 0, sizeof(*sac));
- controller = kmalloc(sizeof(*controller), GFP_KERNEL);
+ controller = kzalloc(sizeof(*controller), GFP_KERNEL);
if (!controller)
panic(PFX "Couldn't allocate struct pci_controller");
- memset(controller, 0, sizeof(*controller));
controller->iommu = ioc;
sac->sysdata = controller;
@@ -1738,12 +1736,10 @@ ioc_init(u64 hpa, void *handle)
struct ioc *ioc;
struct ioc_iommu *info;
- ioc = kmalloc(sizeof(*ioc), GFP_KERNEL);
+ ioc = kzalloc(sizeof(*ioc), GFP_KERNEL);
if (!ioc)
return NULL;
- memset(ioc, 0, sizeof(*ioc));
-
ioc->next = ioc_list;
ioc_list = ioc;
--- linux-2.6.16-rc5-mm1/arch/ia64/sn/kernel/xpc_channel.c.orig 2006-03-04 19:38:27.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/ia64/sn/kernel/xpc_channel.c 2006-03-04 19:39:19.000000000 +0100
@@ -93,13 +93,12 @@ xpc_setup_infrastructure(struct xpc_part
* Allocate all of the channel structures as a contiguous chunk of
* memory.
*/
- part->channels = kmalloc(sizeof(struct xpc_channel) * XPC_NCHANNELS,
+ part->channels = kzalloc(sizeof(struct xpc_channel) * XPC_NCHANNELS,
GFP_KERNEL);
if (part->channels == NULL) {
dev_err(xpc_chan, "can't get memory for channels\n");
return xpcNoMemory;
}
- memset(part->channels, 0, sizeof(struct xpc_channel) * XPC_NCHANNELS);
part->nchannels = XPC_NCHANNELS;
@@ -455,13 +454,12 @@ xpc_allocate_local_msgqueue(struct xpc_c
memset(ch->local_msgqueue, 0, nbytes);
nbytes = nentries * sizeof(struct xpc_notify);
- ch->notify_queue = kmalloc(nbytes, GFP_KERNEL);
+ ch->notify_queue = kzalloc(nbytes, GFP_KERNEL);
if (ch->notify_queue == NULL) {
kfree(ch->local_msgqueue_base);
ch->local_msgqueue = NULL;
continue;
}
- memset(ch->notify_queue, 0, nbytes);
spin_lock_irqsave(&ch->lock, irq_flags);
if (nentries < ch->local_nentries) {
--- linux-2.6.16-rc5-mm1/arch/ia64/pci/pci.c.orig 2006-03-04 19:40:09.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/ia64/pci/pci.c 2006-03-04 19:40:18.000000000 +0100
@@ -127,11 +127,10 @@ alloc_pci_controller (int seg)
{
struct pci_controller *controller;
- controller = kmalloc(sizeof(*controller), GFP_KERNEL);
+ controller = kzalloc(sizeof(*controller), GFP_KERNEL);
if (!controller)
return NULL;
- memset(controller, 0, sizeof(*controller));
controller->segment = seg;
controller->node = -1;
return controller;
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 11+ messages in thread
* [KJ] [Patch] kzalloc() conversion in arch/i386
2006-03-04 19:09 [KJ] [Patch] kzalloc() conversion in arch/ia64 Eric Sesterhenn
@ 2006-03-04 19:09 ` Eric Sesterhenn
2006-03-06 20:13 ` [KJ] [Patch] kzalloc() conversion in arch/sparc Eric Sesterhenn
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Eric Sesterhenn @ 2006-03-04 19:09 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 10189 bytes --]
hi,
this patch converts drivers/block to kzalloc usage.
Compile tested with allyesconfig, which does not contain
the voyager file.
I noticed that voyager_cat_init() does not check if kmalloc() succeeds,
which might result in a NULL pointer dereference.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.16-rc5-mm1/arch/i386/kernel/cpu/intel_cacheinfo.c.orig 2006-03-04 19:41:58.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/i386/kernel/cpu/intel_cacheinfo.c 2006-03-04 19:43:18.000000000 +0100
@@ -393,12 +393,10 @@ static int __cpuinit detect_cache_attrib
if (num_cache_leaves == 0)
return -ENOENT;
- cpuid4_info[cpu] = kmalloc(
- sizeof(struct _cpuid4_info) * num_cache_leaves, GFP_KERNEL);
+ cpuid4_info[cpu] = kcalloc(num_cache_leaves,
+ sizeof(struct _cpuid4_info), GFP_KERNEL);
if (unlikely(cpuid4_info[cpu] == NULL))
return -ENOMEM;
- memset(cpuid4_info[cpu], 0,
- sizeof(struct _cpuid4_info) * num_cache_leaves);
oldmask = current->cpus_allowed;
retval = set_cpus_allowed(current, cpumask_of_cpu(cpu));
@@ -571,17 +569,14 @@ static int __cpuinit cpuid4_cache_sysfs_
return -ENOENT;
/* Allocate all required memory */
- cache_kobject[cpu] = kmalloc(sizeof(struct kobject), GFP_KERNEL);
+ cache_kobject[cpu] = kzalloc(sizeof(struct kobject), GFP_KERNEL);
if (unlikely(cache_kobject[cpu] == NULL))
goto err_out;
- memset(cache_kobject[cpu], 0, sizeof(struct kobject));
- index_kobject[cpu] = kmalloc(
- sizeof(struct _index_kobject ) * num_cache_leaves, GFP_KERNEL);
+ index_kobject[cpu] = kcalloc(num_cache_leaves,
+ sizeof(struct _index_kobject), GFP_KERNEL);
if (unlikely(index_kobject[cpu] == NULL))
goto err_out;
- memset(index_kobject[cpu], 0,
- sizeof(struct _index_kobject) * num_cache_leaves);
return 0;
--- linux-2.6.16-rc5-mm1/arch/i386/kernel/cpu/mtrr/main.c.orig 2006-03-04 19:43:30.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/i386/kernel/cpu/mtrr/main.c 2006-03-04 19:43:46.000000000 +0100
@@ -565,10 +565,8 @@ static int mtrr_save(struct sys_device *
int i;
int size = num_var_ranges * sizeof(struct mtrr_value);
- mtrr_state = kmalloc(size,GFP_ATOMIC);
- if (mtrr_state)
- memset(mtrr_state,0,size);
- else
+ mtrr_state = kzalloc(size,GFP_ATOMIC);
+ if (!mtrr_state)
return -ENOMEM;
for (i = 0; i < num_var_ranges; i++) {
--- linux-2.6.16-rc5-mm1/arch/i386/kernel/cpu/mtrr/if.c.orig 2006-03-04 19:43:53.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/i386/kernel/cpu/mtrr/if.c 2006-03-04 19:44:21.000000000 +0100
@@ -44,10 +44,9 @@ mtrr_file_add(unsigned long base, unsign
max = num_var_ranges;
if (fcount == NULL) {
- fcount = kmalloc(max * sizeof *fcount, GFP_KERNEL);
+ fcount = kcalloc(max, sizeof(*fcount), GFP_KERNEL);
if (!fcount)
return -ENOMEM;
- memset(fcount, 0, max * sizeof *fcount);
FILE_FCOUNT(file) = fcount;
}
if (!page) {
--- linux-2.6.16-rc5-mm1/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c.orig 2006-03-04 19:44:37.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c 2006-03-04 19:44:46.000000000 +0100
@@ -459,10 +459,9 @@ static int __init cpufreq_gx_init(void)
dprintk("geode suspend modulation available.\n");
- params = kmalloc(sizeof(struct gxfreq_params), GFP_KERNEL);
+ params = kzalloc(sizeof(struct gxfreq_params), GFP_KERNEL);
if (params == NULL)
return -ENOMEM;
- memset(params, 0, sizeof(struct gxfreq_params));
params->cs55x0 = gx_pci;
gx_params = params;
--- linux-2.6.16-rc5-mm1/arch/i386/kernel/mca.c.orig 2006-03-04 19:44:56.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/i386/kernel/mca.c 2006-03-04 19:45:25.000000000 +0100
@@ -283,10 +283,9 @@ static int __init mca_init(void)
bus->f.mca_transform_memory = mca_dummy_transform_memory;
/* get the motherboard device */
- mca_dev = kmalloc(sizeof(struct mca_device), GFP_KERNEL);
+ mca_dev = kzalloc(sizeof(struct mca_device), GFP_KERNEL);
if(unlikely(!mca_dev))
goto out_nomem;
- memset(mca_dev, 0, sizeof(struct mca_device));
/*
* We do not expect many MCA interrupts during initialization,
@@ -310,10 +309,9 @@ static int __init mca_init(void)
mca_dev->slot = MCA_MOTHERBOARD;
mca_register_device(MCA_PRIMARY_BUS, mca_dev);
- mca_dev = kmalloc(sizeof(struct mca_device), GFP_ATOMIC);
+ mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC);
if(unlikely(!mca_dev))
goto out_unlock_nomem;
- memset(mca_dev, 0, sizeof(struct mca_device));
/* Put motherboard into video setup mode, read integrated video
@@ -349,10 +347,9 @@ static int __init mca_init(void)
}
if(which_scsi) {
/* found a scsi card */
- mca_dev = kmalloc(sizeof(struct mca_device), GFP_ATOMIC);
+ mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC);
if(unlikely(!mca_dev))
goto out_unlock_nomem;
- memset(mca_dev, 0, sizeof(struct mca_device));
for(j = 0; j < 8; j++)
mca_dev->pos[j] = pos[j];
@@ -378,10 +375,9 @@ static int __init mca_init(void)
if(!mca_read_and_store_pos(pos))
continue;
- mca_dev = kmalloc(sizeof(struct mca_device), GFP_ATOMIC);
+ mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC);
if(unlikely(!mca_dev))
goto out_unlock_nomem;
- memset(mca_dev, 0, sizeof(struct mca_device));
for(j=0; j<8; j++)
mca_dev->pos[j]=pos[j];
--- linux-2.6.16-rc5-mm1/arch/i386/kernel/pci-dma.c.orig 2006-03-04 19:45:32.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/i386/kernel/pci-dma.c 2006-03-04 19:46:01.000000000 +0100
@@ -92,14 +92,12 @@ int dma_declare_coherent_memory(struct d
if (!mem_base)
goto out;
- dev->dma_mem = kmalloc(sizeof(struct dma_coherent_mem), GFP_KERNEL);
+ dev->dma_mem = kzalloc(sizeof(struct dma_coherent_mem), GFP_KERNEL);
if (!dev->dma_mem)
goto out;
- memset(dev->dma_mem, 0, sizeof(struct dma_coherent_mem));
- dev->dma_mem->bitmap = kmalloc(bitmap_size, GFP_KERNEL);
+ dev->dma_mem->bitmap = kzalloc(bitmap_size, GFP_KERNEL);
if (!dev->dma_mem->bitmap)
goto free1_out;
- memset(dev->dma_mem->bitmap, 0, bitmap_size);
dev->dma_mem->virt_base = mem_base;
dev->dma_mem->device_base = device_addr;
--- linux-2.6.16-rc5-mm1/arch/i386/kernel/io_apic.c.orig 2006-03-04 19:46:10.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/i386/kernel/io_apic.c 2006-03-04 19:46:42.000000000 +0100
@@ -614,14 +614,12 @@ static int __init balanced_irq_init(void
physical_balance = 1;
for_each_online_cpu(i) {
- irq_cpu_data[i].irq_delta = kmalloc(sizeof(unsigned long) * NR_IRQS, GFP_KERNEL);
- irq_cpu_data[i].last_irq = kmalloc(sizeof(unsigned long) * NR_IRQS, GFP_KERNEL);
+ irq_cpu_data[i].irq_delta = kzalloc(sizeof(unsigned long) * NR_IRQS, GFP_KERNEL);
+ irq_cpu_data[i].last_irq = kzalloc(sizeof(unsigned long) * NR_IRQS, GFP_KERNEL);
if (irq_cpu_data[i].irq_delta == NULL || irq_cpu_data[i].last_irq == NULL) {
printk(KERN_ERR "balanced_irq_init: out of memory");
goto failed;
}
- memset(irq_cpu_data[i].irq_delta,0,sizeof(unsigned long) * NR_IRQS);
- memset(irq_cpu_data[i].last_irq,0,sizeof(unsigned long) * NR_IRQS);
}
printk(KERN_INFO "Starting balanced_irq\n");
--- linux-2.6.16-rc5-mm1/arch/i386/mach-voyager/voyager_cat.c.orig 2006-03-04 19:46:58.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/i386/mach-voyager/voyager_cat.c 2006-03-04 19:48:39.000000000 +0100
@@ -644,20 +644,18 @@ voyager_cat_init(void)
}
CDEBUG(("VOYAGER DEBUG: found module id 0x%x, %s\n", i,
cat_module_name(i)));
- *modpp = kmalloc(sizeof(voyager_module_t), GFP_KERNEL); /*&voyager_module_storage[cat_count++];*/
+ *modpp = kzalloc(sizeof(voyager_module_t), GFP_KERNEL); /*&voyager_module_storage[cat_count++];*/
if(*modpp == NULL) {
printk("**WARNING** kmalloc failure in cat_init\n");
continue;
}
- memset(*modpp, 0, sizeof(voyager_module_t));
/* need temporary asic for cat_subread. It will be
* filled in correctly later */
- (*modpp)->asic = kmalloc(sizeof(voyager_asic_t), GFP_KERNEL); /*&voyager_asic_storage[asic_count];*/
+ (*modpp)->asic = kzalloc(sizeof(voyager_asic_t), GFP_KERNEL); /*&voyager_asic_storage[asic_count];*/
if((*modpp)->asic == NULL) {
printk("**WARNING** kmalloc failure in cat_init\n");
continue;
}
- memset((*modpp)->asic, 0, sizeof(voyager_asic_t));
(*modpp)->asic->asic_id = VOYAGER_CAT_ID;
(*modpp)->asic->subaddr = VOYAGER_SUBADDR_HI;
(*modpp)->module_addr = i;
@@ -772,7 +770,7 @@ voyager_cat_init(void)
for(asic=0; asic < (*modpp)->num_asics; asic++) {
int j;
voyager_asic_t *asicp = *asicpp
- = kmalloc(sizeof(voyager_asic_t), GFP_KERNEL); /*&voyager_asic_storage[asic_count++];*/
+ = kzalloc(sizeof(voyager_asic_t), GFP_KERNEL); /*&voyager_asic_storage[asic_count++];*/
voyager_sp_table_t *sp_table;
voyager_at_t *asic_table;
voyager_jtt_t *jtag_table;
@@ -781,7 +779,6 @@ voyager_cat_init(void)
printk("**WARNING** kmalloc failure in cat_init\n");
continue;
}
- memset(asicp, 0, sizeof(voyager_asic_t));
asicpp = &(asicp->next);
asicp->asic_location = asic;
sp_table = (voyager_sp_table_t *)(eprom_buf + sp_offset);
@@ -847,8 +844,7 @@ voyager_cat_init(void)
#endif
{
- struct resource *res = kmalloc(sizeof(struct resource),GFP_KERNEL);
- memset(res, 0, sizeof(struct resource));
+ struct resource *res = kzalloc(sizeof(struct resource),GFP_KERNEL);
res->name = kmalloc(128, GFP_KERNEL);
sprintf((char *)res->name, "Voyager %s Quad CPI", cat_module_name(i));
res->start = qic_addr;
--- linux-2.6.16-rc5-mm1/arch/i386/pci/pcbios.c.orig 2006-03-04 19:49:03.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/i386/pci/pcbios.c 2006-03-04 19:49:11.000000000 +0100
@@ -445,9 +445,8 @@ struct irq_routing_table * __devinit pci
if (ret & 0xff00)
printk(KERN_ERR "PCI: Error %02x when fetching IRQ routing table.\n", (ret >> 8) & 0xff);
else if (opt.size) {
- rt = kmalloc(sizeof(struct irq_routing_table) + opt.size, GFP_KERNEL);
+ rt = kzalloc(sizeof(struct irq_routing_table) + opt.size, GFP_KERNEL);
if (rt) {
- memset(rt, 0, sizeof(struct irq_routing_table));
rt->size = opt.size + sizeof(struct irq_routing_table);
rt->exclusive_irqs = map;
memcpy(rt->slots, (void *) page, opt.size);
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 11+ messages in thread
* [KJ] [Patch] kzalloc() conversion in arch/sparc
2006-03-04 19:09 [KJ] [Patch] kzalloc() conversion in arch/ia64 Eric Sesterhenn
2006-03-04 19:09 ` [KJ] [Patch] kzalloc() conversion in arch/i386 Eric Sesterhenn
@ 2006-03-06 20:13 ` Eric Sesterhenn
2006-03-06 20:13 ` [KJ] [Patch] kzalloc() conversion in arch/sparc64 Eric Sesterhenn
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Eric Sesterhenn @ 2006-03-06 20:13 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 2541 bytes --]
hi,
this patch converts arch/sparc to kzalloc usage.
Crosscompile tested with allyesconfig.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.16-rc5-mm1/arch/sparc/kernel/sun4d_irq.c.orig 2006-03-06 20:36:52.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/sparc/kernel/sun4d_irq.c 2006-03-06 20:37:27.000000000 +0100
@@ -542,8 +542,7 @@ void __init sun4d_init_sbi_irq(void)
nsbi = 0;
for_each_sbus(sbus)
nsbi++;
- sbus_actions = (struct sbus_action *)kmalloc (nsbi * 8 * 4 * sizeof(struct sbus_action), GFP_ATOMIC);
- memset (sbus_actions, 0, (nsbi * 8 * 4 * sizeof(struct sbus_action)));
+ sbus_actions = kzalloc(nsbi * 8 * 4 * sizeof(struct sbus_action), GFP_ATOMIC);
for_each_sbus(sbus) {
#ifdef CONFIG_SMP
extern unsigned char boot_cpu_id;
--- linux-2.6.16-rc5-mm1/arch/sparc/kernel/ioport.c.orig 2006-03-06 20:37:35.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/sparc/kernel/ioport.c 2006-03-06 20:38:12.000000000 +0100
@@ -255,9 +255,8 @@ void *sbus_alloc_consistent(struct sbus_
if ((va = __get_free_pages(GFP_KERNEL|__GFP_COMP, order)) == 0)
goto err_nopages;
- if ((res = kmalloc(sizeof(struct resource), GFP_KERNEL)) == NULL)
+ if ((res = kzalloc(sizeof(struct resource), GFP_KERNEL)) == NULL)
goto err_nomem;
- memset((char*)res, 0, sizeof(struct resource));
if (allocate_resource(&_sparc_dvma, res, len_total,
_sparc_dvma.start, _sparc_dvma.end, PAGE_SIZE, NULL, NULL) != 0) {
@@ -437,12 +436,11 @@ void *pci_alloc_consistent(struct pci_de
return NULL;
}
- if ((res = kmalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) {
+ if ((res = kzalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) {
free_pages(va, order);
printk("pci_alloc_consistent: no core\n");
return NULL;
}
- memset((char*)res, 0, sizeof(struct resource));
if (allocate_resource(&_sparc_dvma, res, len_total,
_sparc_dvma.start, _sparc_dvma.end, PAGE_SIZE, NULL, NULL) != 0) {
--- linux-2.6.16-rc5-mm1/arch/sparc/mm/io-unit.c.orig 2006-03-06 20:38:26.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/sparc/mm/io-unit.c 2006-03-06 20:38:40.000000000 +0100
@@ -42,9 +42,8 @@ iounit_init(int sbi_node, int io_node, s
struct linux_prom_registers iommu_promregs[PROMREG_MAX];
struct resource r;
- iounit = kmalloc(sizeof(struct iounit_struct), GFP_ATOMIC);
+ iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC);
- memset(iounit, 0, sizeof(*iounit));
iounit->limit[0] = IOUNIT_BMAP1_START;
iounit->limit[1] = IOUNIT_BMAP2_START;
iounit->limit[2] = IOUNIT_BMAPM_START;
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 11+ messages in thread
* [KJ] [Patch] kzalloc() conversion in arch/sparc64
2006-03-04 19:09 [KJ] [Patch] kzalloc() conversion in arch/ia64 Eric Sesterhenn
2006-03-04 19:09 ` [KJ] [Patch] kzalloc() conversion in arch/i386 Eric Sesterhenn
2006-03-06 20:13 ` [KJ] [Patch] kzalloc() conversion in arch/sparc Eric Sesterhenn
@ 2006-03-06 20:13 ` Eric Sesterhenn
2006-03-06 20:13 ` [KJ] [Patch] kzalloc() conversion in arch/ppc Eric Sesterhenn
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Eric Sesterhenn @ 2006-03-06 20:13 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 11017 bytes --]
hi,
this patch converts arch/sparc64 to kzalloc usage.
Crosscompile tested with allyesconfig.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.16-rc5-mm1/arch/sparc64/kernel/setup.c.orig 2006-03-06 20:50:25.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/sparc64/kernel/setup.c 2006-03-06 20:50:36.000000000 +0100
@@ -537,9 +537,8 @@ static int __init topology_init(void)
ncpus_probed++;
for_each_cpu(i) {
- struct cpu *p = kmalloc(sizeof(*p), GFP_KERNEL);
+ struct cpu *p = kzalloc(sizeof(*p), GFP_KERNEL);
if (p) {
- memset(p, 0, sizeof(*p));
register_cpu(p, i, NULL);
err = 0;
}
--- linux-2.6.16-rc5-mm1/arch/sparc64/kernel/us3_cpufreq.c.orig 2006-03-06 20:50:45.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/sparc64/kernel/us3_cpufreq.c 2006-03-06 20:51:10.000000000 +0100
@@ -218,20 +218,16 @@ static int __init us3_freq_init(void)
struct cpufreq_driver *driver;
ret = -ENOMEM;
- driver = kmalloc(sizeof(struct cpufreq_driver), GFP_KERNEL);
+ driver = kzalloc(sizeof(struct cpufreq_driver), GFP_KERNEL);
if (!driver)
goto err_out;
- memset(driver, 0, sizeof(*driver));
- us3_freq_table = kmalloc(
+ us3_freq_table = kzalloc(
(NR_CPUS * sizeof(struct us3_freq_percpu_info)),
GFP_KERNEL);
if (!us3_freq_table)
goto err_out;
- memset(us3_freq_table, 0,
- (NR_CPUS * sizeof(struct us3_freq_percpu_info)));
-
driver->init = us3_freq_cpu_init;
driver->verify = us3_freq_verify;
driver->target = us3_freq_target;
--- linux-2.6.16-rc5-mm1/arch/sparc64/kernel/sys_sparc.c.orig 2006-03-06 20:51:25.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/sparc64/kernel/sys_sparc.c 2006-03-06 20:51:42.000000000 +0100
@@ -554,12 +554,10 @@ asmlinkage long sys_utrap_install(utrap_
}
if (!current_thread_info()->utraps) {
current_thread_info()->utraps =
- kmalloc((UT_TRAP_INSTRUCTION_31+1)*sizeof(long), GFP_KERNEL);
+ kzalloc((UT_TRAP_INSTRUCTION_31+1)*sizeof(long), GFP_KERNEL);
if (!current_thread_info()->utraps)
return -ENOMEM;
current_thread_info()->utraps[0] = 1;
- memset(current_thread_info()->utraps+1, 0,
- UT_TRAP_INSTRUCTION_31*sizeof(long));
} else {
if ((utrap_handler_t)current_thread_info()->utraps[type] != new_p &&
current_thread_info()->utraps[0] > 1) {
--- linux-2.6.16-rc5-mm1/arch/sparc64/kernel/irq.c.orig 2006-03-06 20:51:52.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/sparc64/kernel/irq.c 2006-03-06 20:52:22.000000000 +0100
@@ -314,12 +314,11 @@ unsigned int build_irq(int pil, int inof
goto out;
}
- bucket->irq_info = kmalloc(sizeof(struct irq_desc), GFP_ATOMIC);
+ bucket->irq_info = kzalloc(sizeof(struct irq_desc), GFP_ATOMIC);
if (!bucket->irq_info) {
prom_printf("IRQ: Error, kmalloc(irq_desc) failed.\n");
prom_halt();
}
- memset(bucket->irq_info, 0, sizeof(struct irq_desc));
/* Ok, looks good, set it up. Don't touch the irq_chain or
* the pending flag.
@@ -355,12 +354,11 @@ unsigned int sun4v_build_irq(u32 devhand
bucket->pil = pil;
bucket->flags = flags;
- bucket->irq_info = kmalloc(sizeof(struct irq_desc), GFP_ATOMIC);
+ bucket->irq_info = kzalloc(sizeof(struct irq_desc), GFP_ATOMIC);
if (!bucket->irq_info) {
prom_printf("IRQ: Error, kmalloc(irq_desc) failed.\n");
prom_halt();
}
- memset(bucket->irq_info, 0, sizeof(struct irq_desc));
return __irq(bucket);
}
--- linux-2.6.16-rc5-mm1/arch/sparc64/kernel/pci_iommu.c.orig 2006-03-06 20:52:31.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/sparc64/kernel/pci_iommu.c 2006-03-06 20:52:52.000000000 +0100
@@ -139,12 +139,11 @@ void pci_iommu_table_init(struct pci_iom
/* Allocate and initialize the free area map. */
sz = num_tsb_entries / 8;
sz = (sz + 7UL) & ~7UL;
- iommu->arena.map = kmalloc(sz, GFP_KERNEL);
+ iommu->arena.map = kzalloc(sz, GFP_KERNEL);
if (!iommu->arena.map) {
prom_printf("PCI_IOMMU: Error, kmalloc(arena.map) failed.\n");
prom_halt();
}
- memset(iommu->arena.map, 0, sz);
iommu->arena.limit = num_tsb_entries;
/* Allocate and initialize the dummy page which we
--- linux-2.6.16-rc5-mm1/arch/sparc64/kernel/us2e_cpufreq.c.orig 2006-03-06 20:53:00.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/sparc64/kernel/us2e_cpufreq.c 2006-03-06 20:53:23.000000000 +0100
@@ -357,20 +357,16 @@ static int __init us2e_freq_init(void)
struct cpufreq_driver *driver;
ret = -ENOMEM;
- driver = kmalloc(sizeof(struct cpufreq_driver), GFP_KERNEL);
+ driver = kzalloc(sizeof(struct cpufreq_driver), GFP_KERNEL);
if (!driver)
goto err_out;
- memset(driver, 0, sizeof(*driver));
- us2e_freq_table = kmalloc(
+ us2e_freq_table = kzalloc(
(NR_CPUS * sizeof(struct us2e_freq_percpu_info)),
GFP_KERNEL);
if (!us2e_freq_table)
goto err_out;
- memset(us2e_freq_table, 0,
- (NR_CPUS * sizeof(struct us2e_freq_percpu_info)));
-
driver->init = us2e_freq_cpu_init;
driver->verify = us2e_freq_verify;
driver->target = us2e_freq_target;
--- linux-2.6.16-rc5-mm1/arch/sparc64/kernel/ebus.c.orig 2006-03-06 20:53:31.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/sparc64/kernel/ebus.c 2006-03-06 20:53:47.000000000 +0100
@@ -277,10 +277,9 @@ static inline void *ebus_alloc(size_t si
{
void *mem;
- mem = kmalloc(size, GFP_ATOMIC);
+ mem = kzalloc(size, GFP_ATOMIC);
if (!mem)
panic("ebus_alloc: out of memory");
- memset((char *)mem, 0, size);
return mem;
}
--- linux-2.6.16-rc5-mm1/arch/sparc64/kernel/pci_psycho.c.orig 2006-03-06 20:53:57.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/sparc64/kernel/pci_psycho.c 2006-03-06 20:54:31.000000000 +0100
@@ -1164,7 +1164,7 @@ static void pbm_config_busmastering(stru
static void pbm_scan_bus(struct pci_controller_info *p,
struct pci_pbm_info *pbm)
{
- struct pcidev_cookie *cookie = kmalloc(sizeof(*cookie), GFP_KERNEL);
+ struct pcidev_cookie *cookie = kzalloc(sizeof(*cookie), GFP_KERNEL);
if (!cookie) {
prom_printf("PSYCHO: Critical allocation failure.\n");
@@ -1172,7 +1172,6 @@ static void pbm_scan_bus(struct pci_cont
}
/* All we care about is the PBM. */
- memset(cookie, 0, sizeof(*cookie));
cookie->pbm = pbm;
pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno,
@@ -1465,18 +1464,16 @@ void psycho_init(int node, char *model_n
}
}
- p = kmalloc(sizeof(struct pci_controller_info), GFP_ATOMIC);
+ p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC);
if (!p) {
prom_printf("PSYCHO: Fatal memory allocation error.\n");
prom_halt();
}
- memset(p, 0, sizeof(*p));
- iommu = kmalloc(sizeof(struct pci_iommu), GFP_ATOMIC);
+ iommu = kzalloc(sizeof(struct pci_iommu), GFP_ATOMIC);
if (!iommu) {
prom_printf("PSYCHO: Fatal memory allocation error.\n");
prom_halt();
}
- memset(iommu, 0, sizeof(*iommu));
p->pbm_A.iommu = p->pbm_B.iommu = iommu;
p->next = pci_controller_root;
--- linux-2.6.16-rc5-mm1/arch/sparc64/kernel/pci_sabre.c.orig 2006-03-06 20:54:39.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/sparc64/kernel/pci_sabre.c 2006-03-06 20:55:18.000000000 +0100
@@ -1167,7 +1167,7 @@ static void apb_init(struct pci_controll
static struct pcidev_cookie *alloc_bridge_cookie(struct pci_pbm_info *pbm)
{
- struct pcidev_cookie *cookie = kmalloc(sizeof(*cookie), GFP_KERNEL);
+ struct pcidev_cookie *cookie = kzalloc(sizeof(*cookie), GFP_KERNEL);
if (!cookie) {
prom_printf("SABRE: Critical allocation failure.\n");
@@ -1175,7 +1175,6 @@ static struct pcidev_cookie *alloc_bridg
}
/* All we care about is the PBM. */
- memset(cookie, 0, sizeof(*cookie));
cookie->pbm = pbm;
return cookie;
@@ -1556,19 +1555,17 @@ void sabre_init(int pnode, char *model_n
}
}
- p = kmalloc(sizeof(*p), GFP_ATOMIC);
+ p = kzalloc(sizeof(*p), GFP_ATOMIC);
if (!p) {
prom_printf("SABRE: Error, kmalloc(pci_controller_info) failed.\n");
prom_halt();
}
- memset(p, 0, sizeof(*p));
- iommu = kmalloc(sizeof(*iommu), GFP_ATOMIC);
+ iommu = kzalloc(sizeof(*iommu), GFP_ATOMIC);
if (!iommu) {
prom_printf("SABRE: Error, kmalloc(pci_iommu) failed.\n");
prom_halt();
}
- memset(iommu, 0, sizeof(*iommu));
p->pbm_A.iommu = p->pbm_B.iommu = iommu;
upa_portid = prom_getintdefault(pnode, "upa-portid", 0xff);
--- linux-2.6.16-rc5-mm1/arch/sparc64/kernel/pci_common.c.orig 2006-03-06 20:55:26.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/sparc64/kernel/pci_common.c 2006-03-06 20:56:02.000000000 +0100
@@ -977,33 +977,30 @@ void pci_register_legacy_regions(struct
struct resource *p;
/* VGA Video RAM. */
- p = kmalloc(sizeof(*p), GFP_KERNEL);
+ p = kzalloc(sizeof(*p), GFP_KERNEL);
if (!p)
return;
- memset(p, 0, sizeof(*p));
p->name = "Video RAM area";
p->start = mem_res->start + 0xa0000UL;
p->end = p->start + 0x1ffffUL;
p->flags = IORESOURCE_BUSY;
request_resource(mem_res, p);
- p = kmalloc(sizeof(*p), GFP_KERNEL);
+ p = kzalloc(sizeof(*p), GFP_KERNEL);
if (!p)
return;
- memset(p, 0, sizeof(*p));
p->name = "System ROM";
p->start = mem_res->start + 0xf0000UL;
p->end = p->start + 0xffffUL;
p->flags = IORESOURCE_BUSY;
request_resource(mem_res, p);
- p = kmalloc(sizeof(*p), GFP_KERNEL);
+ p = kzalloc(sizeof(*p), GFP_KERNEL);
if (!p)
return;
- memset(p, 0, sizeof(*p));
p->name = "Video ROM";
p->start = mem_res->start + 0xc0000UL;
p->end = p->start + 0x7fffUL;
--- linux-2.6.16-rc5-mm1/arch/sparc64/kernel/pci_schizo.c.orig 2006-03-06 20:56:12.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/sparc64/kernel/pci_schizo.c 2006-03-06 20:56:41.000000000 +0100
@@ -1525,7 +1525,7 @@ static void pbm_config_busmastering(stru
static void pbm_scan_bus(struct pci_controller_info *p,
struct pci_pbm_info *pbm)
{
- struct pcidev_cookie *cookie = kmalloc(sizeof(*cookie), GFP_KERNEL);
+ struct pcidev_cookie *cookie = kzalloc(sizeof(*cookie), GFP_KERNEL);
if (!cookie) {
prom_printf("%s: Critical allocation failure.\n", pbm->name);
@@ -1533,7 +1533,6 @@ static void pbm_scan_bus(struct pci_cont
}
/* All we care about is the PBM. */
- memset(cookie, 0, sizeof(*cookie));
cookie->pbm = pbm;
pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno,
@@ -2120,27 +2119,24 @@ static void __schizo_init(int node, char
}
}
- p = kmalloc(sizeof(struct pci_controller_info), GFP_ATOMIC);
+ p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC);
if (!p) {
prom_printf("SCHIZO: Fatal memory allocation error.\n");
prom_halt();
}
- memset(p, 0, sizeof(*p));
- iommu = kmalloc(sizeof(struct pci_iommu), GFP_ATOMIC);
+ iommu = kzalloc(sizeof(struct pci_iommu), GFP_ATOMIC);
if (!iommu) {
prom_printf("SCHIZO: Fatal memory allocation error.\n");
prom_halt();
}
- memset(iommu, 0, sizeof(*iommu));
p->pbm_A.iommu = iommu;
- iommu = kmalloc(sizeof(struct pci_iommu), GFP_ATOMIC);
+ iommu = kzalloc(sizeof(struct pci_iommu), GFP_ATOMIC);
if (!iommu) {
prom_printf("SCHIZO: Fatal memory allocation error.\n");
prom_halt();
}
- memset(iommu, 0, sizeof(*iommu));
p->pbm_B.iommu = iommu;
p->next = pci_controller_root;
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 11+ messages in thread
* [KJ] [Patch] kzalloc() conversion in arch/ppc
2006-03-04 19:09 [KJ] [Patch] kzalloc() conversion in arch/ia64 Eric Sesterhenn
` (2 preceding siblings ...)
2006-03-06 20:13 ` [KJ] [Patch] kzalloc() conversion in arch/sparc64 Eric Sesterhenn
@ 2006-03-06 20:13 ` Eric Sesterhenn
2006-03-07 8:53 ` [KJ] [Patch] kzalloc() conversion in arch/powerpc Eric Sesterhenn
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Eric Sesterhenn @ 2006-03-06 20:13 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 3059 bytes --]
hi,
this patch converts arch/ppc to kzalloc usage.
Crosscompile tested with allyesconfig.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.16-rc5-mm1/arch/ppc/syslib/ocp.c.orig 2006-03-06 21:03:01.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/ppc/syslib/ocp.c 2006-03-06 21:03:14.000000000 +0100
@@ -451,10 +451,9 @@ ocp_driver_init(void)
DBG(("ocp: ocp_driver_init()...\n"));
/* Allocate/register primary OCP bus */
- ocp_bus = kmalloc(sizeof(struct device), GFP_KERNEL);
+ ocp_bus = kzalloc(sizeof(struct device), GFP_KERNEL);
if (ocp_bus == NULL)
return 1;
- memset(ocp_bus, 0, sizeof(struct device));
strcpy(ocp_bus->bus_id, "ocp");
bus_register(&ocp_bus_type);
--- linux-2.6.16-rc5-mm1/arch/ppc/kernel/smp-tbsync.c.orig 2006-03-06 21:03:27.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/ppc/kernel/smp-tbsync.c 2006-03-06 21:03:37.000000000 +0100
@@ -126,8 +126,7 @@ smp_generic_give_timebase( void )
printk("Synchronizing timebase\n");
/* if this fails then this kernel won't work anyway... */
- tbsync = kmalloc( sizeof(*tbsync), GFP_KERNEL );
- memset( tbsync, 0, sizeof(*tbsync) );
+ tbsync = kzalloc( sizeof(*tbsync), GFP_KERNEL );
mb();
running = 1;
--- linux-2.6.16-rc5-mm1/arch/ppc/4xx_io/serial_sicc.c.orig 2006-03-06 21:04:15.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/ppc/4xx_io/serial_sicc.c 2006-03-06 21:04:24.000000000 +0100
@@ -1637,9 +1637,8 @@ static struct SICC_info *siccuart_get(in
state->count++;
if (state->info)
return state->info;
- info = kmalloc(sizeof(struct SICC_info), GFP_KERNEL);
+ info = kzalloc(sizeof(struct SICC_info), GFP_KERNEL);
if (info) {
- memset(info, 0, sizeof(struct SICC_info));
init_waitqueue_head(&info->open_wait);
init_waitqueue_head(&info->close_wait);
init_waitqueue_head(&info->delta_msr_wait);
--- linux-2.6.16-rc5-mm1/arch/ppc/platforms/katana.c.orig 2006-03-06 21:04:45.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/ppc/platforms/katana.c 2006-03-06 21:05:12.000000000 +0100
@@ -662,12 +662,11 @@ katana_setup_mtd(void)
ptbl_entries = (size >= (64*MB)) ? 6 : 4;
- if ((ptbl = kmalloc(ptbl_entries * sizeof(struct mtd_partition),
+ if ((ptbl = kcalloc(ptbl_entries, sizeof(struct mtd_partition),
GFP_KERNEL)) == NULL) {
printk(KERN_WARNING "Can't alloc MTD partition table\n");
return -ENOMEM;
}
- memset(ptbl, 0, ptbl_entries * sizeof(struct mtd_partition));
ptbl[0].name = "Monitor";
ptbl[0].size = KATANA_MTD_MONITOR_SIZE;
--- linux-2.6.16-rc5-mm1/arch/ppc/platforms/radstone_ppc7d.c.orig 2006-03-06 21:05:20.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/ppc/platforms/radstone_ppc7d.c 2006-03-06 21:05:35.000000000 +0100
@@ -683,11 +683,10 @@ ppc7d_fixup_i2c_pdata(struct platform_de
pdata = pdev->dev.platform_data;
if (pdata == NULL) {
- pdata = kmalloc(sizeof(*pdata), GFP_KERNEL);
+ pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
if (pdata == NULL)
return;
- memset(pdata, 0, sizeof(*pdata));
pdev->dev.platform_data = pdata;
}
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 11+ messages in thread
* [KJ] [Patch] kzalloc() conversion in arch/powerpc
2006-03-04 19:09 [KJ] [Patch] kzalloc() conversion in arch/ia64 Eric Sesterhenn
` (3 preceding siblings ...)
2006-03-06 20:13 ` [KJ] [Patch] kzalloc() conversion in arch/ppc Eric Sesterhenn
@ 2006-03-07 8:53 ` Eric Sesterhenn
2006-03-07 8:53 ` [KJ] [Patch] kzalloc() conversion in arch/s390 Eric Sesterhenn
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Eric Sesterhenn @ 2006-03-07 8:53 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 4938 bytes --]
hi,
this patch converts arch/powerpc to kzalloc usage.
Partly tested, didnt get iseries/pseries to compile
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.16-rc5-mm1/arch/powerpc/kernel/pci_64.c.orig 2006-03-06 20:41:42.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/powerpc/kernel/pci_64.c 2006-03-06 20:42:18.000000000 +0100
@@ -363,7 +363,7 @@ struct pci_dev *of_create_pci_dev(struct
struct pci_dev *dev;
const char *type;
- dev = kmalloc(sizeof(struct pci_dev), GFP_KERNEL);
+ dev = kzalloc(sizeof(struct pci_dev), GFP_KERNEL);
if (!dev)
return NULL;
type = get_property(node, "device_type", NULL);
@@ -372,7 +372,6 @@ struct pci_dev *of_create_pci_dev(struct
DBG(" create device, devfn: %x, type: %s\n", devfn, type);
- memset(dev, 0, sizeof(struct pci_dev));
dev->bus = bus;
dev->sysdata = node;
dev->dev.parent = bus->bridge;
--- linux-2.6.16-rc5-mm1/arch/powerpc/kernel/smp-tbsync.c.orig 2006-03-06 20:42:28.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/powerpc/kernel/smp-tbsync.c 2006-03-06 20:42:52.000000000 +0100
@@ -116,8 +116,7 @@ void __devinit smp_generic_give_timebase
printk("Synchronizing timebase\n");
/* if this fails then this kernel won't work anyway... */
- tbsync = kmalloc( sizeof(*tbsync), GFP_KERNEL );
- memset( tbsync, 0, sizeof(*tbsync) );
+ tbsync = kzalloc(sizeof(*tbsync), GFP_KERNEL);
mb();
running = 1;
--- linux-2.6.16-rc5-mm1/arch/powerpc/kernel/ibmebus.c.orig 2006-03-06 20:43:01.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/powerpc/kernel/ibmebus.c 2006-03-06 20:43:10.000000000 +0100
@@ -210,11 +210,10 @@ static struct ibmebus_dev* __devinit ibm
return NULL;
}
- dev = kmalloc(sizeof(struct ibmebus_dev), GFP_KERNEL);
+ dev = kzalloc(sizeof(struct ibmebus_dev), GFP_KERNEL);
if (!dev) {
return NULL;
}
- memset(dev, 0, sizeof(struct ibmebus_dev));
dev->ofdev.node = of_node_get(dn);
--- linux-2.6.16-rc5-mm1/arch/powerpc/platforms/iseries/pci.c.orig 2006-03-06 20:43:46.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/powerpc/platforms/iseries/pci.c 2006-03-06 20:44:09.000000000 +0100
@@ -207,10 +207,9 @@ static struct device_node *build_device_
struct device_node *node;
struct pci_dn *pdn;
- node = kmalloc(sizeof(struct device_node), GFP_KERNEL);
+ node = kzalloc(sizeof(struct device_node), GFP_KERNEL);
if (node == NULL)
return NULL;
- memset(node, 0, sizeof(struct device_node));
pdn = kzalloc(sizeof(*pdn), GFP_KERNEL);
if (pdn == NULL) {
kfree(node);
--- linux-2.6.16-rc5-mm1/arch/powerpc/platforms/iseries/vio.c.orig 2006-03-06 20:45:42.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/powerpc/platforms/iseries/vio.c 2006-03-06 20:45:51.000000000 +0100
@@ -53,10 +53,9 @@ static struct vio_dev *__init vio_regist
struct vio_dev *viodev;
/* allocate a vio_dev for this device */
- viodev = kmalloc(sizeof(struct vio_dev), GFP_KERNEL);
+ viodev = kzalloc(sizeof(struct vio_dev), GFP_KERNEL);
if (!viodev)
return NULL;
- memset(viodev, 0, sizeof(struct vio_dev));
snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%s%d", type, unit_num);
--- linux-2.6.16-rc5-mm1/arch/powerpc/platforms/iseries/iommu.c.orig 2006-03-06 20:45:59.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/powerpc/platforms/iseries/iommu.c 2006-03-06 20:46:18.000000000 +0100
@@ -107,12 +107,10 @@ void iommu_table_getparms_iSeries(unsign
{
struct iommu_table_cb *parms;
- parms = kmalloc(sizeof(*parms), GFP_KERNEL);
+ parms = kzalloc(sizeof(*parms), GFP_KERNEL);
if (parms == NULL)
panic("PCI_DMA: TCE Table Allocation failed.");
- memset(parms, 0, sizeof(*parms));
-
parms->itc_busno = busno;
parms->itc_slotno = slotno;
parms->itc_virtbus = virtbus;
--- linux-2.6.16-rc5-mm1/arch/powerpc/platforms/pseries/reconfig.c.orig 2006-03-06 20:46:31.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/powerpc/platforms/pseries/reconfig.c 2006-03-06 20:46:47.000000000 +0100
@@ -267,11 +267,10 @@ static char * parse_next_property(char *
static struct property *new_property(const char *name, const int length,
const unsigned char *value, struct property *last)
{
- struct property *new = kmalloc(sizeof(*new), GFP_KERNEL);
+ struct property *new = kzalloc(sizeof(*new), GFP_KERNEL);
if (!new)
return NULL;
- memset(new, 0, sizeof(*new));
if (!(new->name = kmalloc(strlen(name) + 1, GFP_KERNEL)))
goto cleanup;
--- linux-2.6.16-rc5-mm1/arch/powerpc/platforms/pseries/vio.c.orig 2006-03-06 20:46:55.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/powerpc/platforms/pseries/vio.c 2006-03-06 20:47:04.000000000 +0100
@@ -167,11 +167,10 @@ struct vio_dev * __devinit vio_register_
}
/* allocate a vio_dev for this node */
- viodev = kmalloc(sizeof(struct vio_dev), GFP_KERNEL);
+ viodev = kzalloc(sizeof(struct vio_dev), GFP_KERNEL);
if (!viodev) {
return NULL;
}
- memset(viodev, 0, sizeof(struct vio_dev));
viodev->dev.platform_data = of_node_get(of_node);
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 11+ messages in thread
* [KJ] [Patch] kzalloc() conversion in arch/s390
2006-03-04 19:09 [KJ] [Patch] kzalloc() conversion in arch/ia64 Eric Sesterhenn
` (4 preceding siblings ...)
2006-03-07 8:53 ` [KJ] [Patch] kzalloc() conversion in arch/powerpc Eric Sesterhenn
@ 2006-03-07 8:53 ` Eric Sesterhenn
2006-03-07 12:12 ` [KJ] [Patch] kzalloc() conversion in arch/alpha Eric Sesterhenn
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Eric Sesterhenn @ 2006-03-07 8:53 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 2323 bytes --]
hi,
this patch converts drivers/rapidio to kzalloc usage.
Crosscompile tested with allyesconfig.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.16-rc5-mm1/arch/s390/kernel/debug.c.orig 2006-03-07 09:22:00.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/s390/kernel/debug.c 2006-03-07 09:24:13.000000000 +0100
@@ -204,16 +204,13 @@ debug_areas_alloc(int pages_per_area, in
goto fail_malloc_areas2;
}
for(j = 0; j < pages_per_area; j++) {
- areas[i][j] = (debug_entry_t*)kmalloc(PAGE_SIZE,
- GFP_KERNEL);
+ areas[i][j] = kzalloc(PAGE_SIZE, GFP_KERNEL);
if(!areas[i][j]) {
for(j--; j >=0 ; j--) {
kfree(areas[i][j]);
}
kfree(areas[i]);
goto fail_malloc_areas2;
- } else {
- memset(areas[i][j],0,PAGE_SIZE);
}
}
}
@@ -249,14 +246,12 @@ debug_info_alloc(char *name, int pages_p
rc = (debug_info_t*) kmalloc(sizeof(debug_info_t), GFP_KERNEL);
if(!rc)
goto fail_malloc_rc;
- rc->active_entries = (int*)kmalloc(nr_areas * sizeof(int), GFP_KERNEL);
+ rc->active_entries = kcalloc(nr_areas, sizeof(int), GFP_KERNEL);
if(!rc->active_entries)
goto fail_malloc_active_entries;
- memset(rc->active_entries, 0, nr_areas * sizeof(int));
- rc->active_pages = (int*)kmalloc(nr_areas * sizeof(int), GFP_KERNEL);
+ rc->active_pages = kcalloc(nr_areas, sizeof(int), GFP_KERNEL);
if(!rc->active_pages)
goto fail_malloc_active_pages;
- memset(rc->active_pages, 0, nr_areas * sizeof(int));
if((mode == ALL_AREAS) && (pages_per_area != 0)){
rc->areas = debug_areas_alloc(pages_per_area, nr_areas);
if(!rc->areas)
--- linux-2.6.16-rc5-mm1/arch/s390/appldata/appldata_base.c.orig 2006-03-07 09:24:23.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/s390/appldata/appldata_base.c 2006-03-07 09:24:36.000000000 +0100
@@ -531,12 +531,11 @@ int appldata_register_ops(struct appldat
P_ERROR("ctl_nr %i already in use!\n", ops->ctl_nr);
return -EBUSY;
}
- ops->ctl_table = kmalloc(4*sizeof(struct ctl_table), GFP_KERNEL);
+ ops->ctl_table = kzalloc(4*sizeof(struct ctl_table), GFP_KERNEL);
if (ops->ctl_table == NULL) {
P_ERROR("Not enough memory for %s ctl_table!\n", ops->name);
return -ENOMEM;
}
- memset(ops->ctl_table, 0, 4*sizeof(struct ctl_table));
spin_lock(&appldata_ops_lock);
list_for_each(lh, &appldata_ops_list) {
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 11+ messages in thread
* [KJ] [Patch] kzalloc() conversion in arch/alpha
2006-03-04 19:09 [KJ] [Patch] kzalloc() conversion in arch/ia64 Eric Sesterhenn
` (5 preceding siblings ...)
2006-03-07 8:53 ` [KJ] [Patch] kzalloc() conversion in arch/s390 Eric Sesterhenn
@ 2006-03-07 12:12 ` Eric Sesterhenn
2006-03-07 12:12 ` [KJ] [Patch] kzalloc() conversion in arch/arm26 Eric Sesterhenn
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Eric Sesterhenn @ 2006-03-07 12:12 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 674 bytes --]
hi,
this patch converts arch/ppc to kzalloc usage.
Crosscompile tested with allyesconfig.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.16-rc5-mm1/arch/alpha/kernel/module.c.orig 2006-03-07 12:29:21.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/alpha/kernel/module.c 2006-03-07 12:29:45.000000000 +0100
@@ -119,8 +119,7 @@ module_frob_arch_sections(Elf64_Ehdr *hd
}
nsyms = symtab->sh_size / sizeof(Elf64_Sym);
- chains = kmalloc(nsyms * sizeof(struct got_entry), GFP_KERNEL);
- memset(chains, 0, nsyms * sizeof(struct got_entry));
+ chains = kcalloc(nsyms, sizeof(struct got_entry), GFP_KERNEL);
got->sh_size = 0;
got->sh_addralign = 8;
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 11+ messages in thread
* [KJ] [Patch] kzalloc() conversion in arch/arm26
2006-03-04 19:09 [KJ] [Patch] kzalloc() conversion in arch/ia64 Eric Sesterhenn
` (6 preceding siblings ...)
2006-03-07 12:12 ` [KJ] [Patch] kzalloc() conversion in arch/alpha Eric Sesterhenn
@ 2006-03-07 12:12 ` Eric Sesterhenn
2006-03-07 12:12 ` [KJ] [Patch] kzalloc() conversion in arch/m68k Eric Sesterhenn
2006-03-07 20:36 ` [KJ] [Patch] kzalloc() conversion in arch/x86_64 Eric Sesterhenn
9 siblings, 0 replies; 11+ messages in thread
From: Eric Sesterhenn @ 2006-03-07 12:12 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 630 bytes --]
hi,
this patch converts arch/ppc to kzalloc usage.
Not tested.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.16-rc5-mm1/arch/arm26/kernel/ecard.c.orig 2006-03-07 12:31:09.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/arm26/kernel/ecard.c 2006-03-07 12:31:18.000000000 +0100
@@ -621,12 +621,10 @@ ecard_probe(int slot, card_type_t type)
struct ex_ecid cid;
int i, rc = -ENOMEM;
- ec = kmalloc(sizeof(ecard_t), GFP_KERNEL);
+ ec = kzalloc(sizeof(ecard_t), GFP_KERNEL);
if (!ec)
goto nomem;
- memset(ec, 0, sizeof(ecard_t));
-
ec->slot_no = slot;
ec->type = type;
ec->irq = NO_IRQ;
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 11+ messages in thread
* [KJ] [Patch] kzalloc() conversion in arch/m68k
2006-03-04 19:09 [KJ] [Patch] kzalloc() conversion in arch/ia64 Eric Sesterhenn
` (7 preceding siblings ...)
2006-03-07 12:12 ` [KJ] [Patch] kzalloc() conversion in arch/arm26 Eric Sesterhenn
@ 2006-03-07 12:12 ` Eric Sesterhenn
2006-03-07 20:36 ` [KJ] [Patch] kzalloc() conversion in arch/x86_64 Eric Sesterhenn
9 siblings, 0 replies; 11+ messages in thread
From: Eric Sesterhenn @ 2006-03-07 12:12 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1312 bytes --]
hi,
this patch converts arch/m64k to kzalloc usage.
Not tested.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.16-rc5-mm1/arch/m68k/amiga/chipram.c.orig 2006-03-07 12:32:58.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/m68k/amiga/chipram.c 2006-03-07 12:33:05.000000000 +0100
@@ -53,10 +53,9 @@ void *amiga_chip_alloc(unsigned long siz
#ifdef DEBUG
printk("amiga_chip_alloc: allocate %ld bytes\n", size);
#endif
- res = kmalloc(sizeof(struct resource), GFP_KERNEL);
+ res = kzalloc(sizeof(struct resource), GFP_KERNEL);
if (!res)
return NULL;
- memset(res, 0, sizeof(struct resource));
res->name = name;
if (allocate_resource(&chipram_res, res, size, 0, UINT_MAX, PAGE_SIZE, NULL, NULL) < 0) {
--- linux-2.6.16-rc5-mm1/arch/m68k/atari/hades-pci.c.orig 2006-03-07 12:33:14.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/m68k/atari/hades-pci.c 2006-03-07 12:33:21.000000000 +0100
@@ -376,10 +376,9 @@ struct pci_bus_info * __init init_hades_
* Allocate memory for bus info structure.
*/
- bus = kmalloc(sizeof(struct pci_bus_info), GFP_KERNEL);
+ bus = kzalloc(sizeof(struct pci_bus_info), GFP_KERNEL);
if (!bus)
return NULL;
- memset(bus, 0, sizeof(struct pci_bus_info));
/*
* Claim resources. The m68k has no separate I/O space, both
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 11+ messages in thread
* [KJ] [Patch] kzalloc() conversion in arch/x86_64
2006-03-04 19:09 [KJ] [Patch] kzalloc() conversion in arch/ia64 Eric Sesterhenn
` (8 preceding siblings ...)
2006-03-07 12:12 ` [KJ] [Patch] kzalloc() conversion in arch/m68k Eric Sesterhenn
@ 2006-03-07 20:36 ` Eric Sesterhenn
9 siblings, 0 replies; 11+ messages in thread
From: Eric Sesterhenn @ 2006-03-07 20:36 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1382 bytes --]
hi,
this patch converts arch/x86_64 to kzalloc usage.
Crosscompile tested with allyesconfig.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.16-rc5-mm1/arch/x86_64/kernel/mce_amd.c.orig 2006-03-07 12:31:44.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/x86_64/kernel/mce_amd.c 2006-03-07 12:31:54.000000000 +0100
@@ -342,12 +342,11 @@ static __cpuinit int threshold_create_ba
}
#endif
- b = kmalloc(sizeof(struct threshold_bank), GFP_KERNEL);
+ b = kzalloc(sizeof(struct threshold_bank), GFP_KERNEL);
if (!b) {
err = -ENOMEM;
goto out;
}
- memset(b, 0, sizeof(struct threshold_bank));
b->cpu = cpu;
b->bank = bank;
--- linux-2.6.16-rc5-mm1/arch/x86_64/kernel/io_apic.c.orig 2006-03-07 12:32:03.000000000 +0100
+++ linux-2.6.16-rc5-mm1/arch/x86_64/kernel/io_apic.c 2006-03-07 12:32:35.000000000 +0100
@@ -2006,12 +2006,11 @@ static int __init ioapic_init_sysfs(void
for (i = 0; i < nr_ioapics; i++ ) {
size = sizeof(struct sys_device) + nr_ioapic_registers[i]
* sizeof(struct IO_APIC_route_entry);
- mp_ioapic_data[i] = kmalloc(size, GFP_KERNEL);
+ mp_ioapic_data[i] = kzalloc(size, GFP_KERNEL);
if (!mp_ioapic_data[i]) {
printk(KERN_ERR "Can't suspend/resume IOAPIC %d\n", i);
continue;
}
- memset(mp_ioapic_data[i], 0, size);
dev = &mp_ioapic_data[i]->dev;
dev->id = i;
dev->cls = &ioapic_sysdev_class;
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2006-03-07 20:36 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-04 19:09 [KJ] [Patch] kzalloc() conversion in arch/ia64 Eric Sesterhenn
2006-03-04 19:09 ` [KJ] [Patch] kzalloc() conversion in arch/i386 Eric Sesterhenn
2006-03-06 20:13 ` [KJ] [Patch] kzalloc() conversion in arch/sparc Eric Sesterhenn
2006-03-06 20:13 ` [KJ] [Patch] kzalloc() conversion in arch/sparc64 Eric Sesterhenn
2006-03-06 20:13 ` [KJ] [Patch] kzalloc() conversion in arch/ppc Eric Sesterhenn
2006-03-07 8:53 ` [KJ] [Patch] kzalloc() conversion in arch/powerpc Eric Sesterhenn
2006-03-07 8:53 ` [KJ] [Patch] kzalloc() conversion in arch/s390 Eric Sesterhenn
2006-03-07 12:12 ` [KJ] [Patch] kzalloc() conversion in arch/alpha Eric Sesterhenn
2006-03-07 12:12 ` [KJ] [Patch] kzalloc() conversion in arch/arm26 Eric Sesterhenn
2006-03-07 12:12 ` [KJ] [Patch] kzalloc() conversion in arch/m68k Eric Sesterhenn
2006-03-07 20:36 ` [KJ] [Patch] kzalloc() conversion in arch/x86_64 Eric Sesterhenn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).