mostly kmalloc + memset conversion to k[cz]alloc
Subsystems (39)
PATCH 1/1 mostly kmalloc + memset conversion to k[cz]alloc
Hello,
This kj patch series does kmalloc + memset conversion to k[cz]alloc. Some
of them also remove redundant argument checks to functions that already do that internally. Also some minor style things are fixed like redundant k[mcz]alloc casts. Most of this patches shrink object size by several hundred bytes (you'll find stats below signed-off line) so this is a good thing. Almost all of them were compile tested.
Please review and apply.
Regards,
Mariusz
PATCH 1/1 kmalloc + memset conversion co kzalloc
drivers/scsi/a4000t.c | 3534 -> 3457 (-77 bytes)
drivers/scsi/a4000t.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/scsi/a4000t.c +3 -4
@@ -37,7 +37,7 @@ static struct platform_device *a4000t_scstatic int __devinit a4000t_probe (struct device *dev) { -struct Scsi_Host * host =NULL ; +struct Scsi_Host *host;struct NCR_700_Host_Parameters *hostdata;if (!(MACH_IS_AMIGA &&AMIGAHW_PRESENT (A4000_SCSI )))
@@ -47,12 +47,11 @@ static int __devinit a4000t_probe(struct "A4000T builtin SCSI")) goto out; - hostdata =kmalloc (sizeof (struct NCR_700_Host_Parameters ),GFP_KERNEL ); -if (hostdata =NULL ) { + hostdata =kzalloc (sizeof (struct NCR_700_Host_Parameters ),GFP_KERNEL ); +if (!hostdata) {printk (KERN_ERR "a4000t-scsi: Failed to allocate host data\n" ); goto out_release; } -memset (hostdata,0 ,sizeof (struct NCR_700_Host_Parameters ));/* Fill in the required pieces of hostdata */ hostdata->base = (void __iomem *)ZTWO_VADDR (A4000T_SCSI_ADDR );
PATCH 1/1 kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/scsi/aic7xxx_old.c | 367101 -> 366983 (-118 bytes) drivers/scsi/aic7xxx_old.o | 333892 -> 333192 (-700 bytes)
drivers/scsi/aic7xxx_old.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/scsi/aic7xxx_old.c +3 -5
@@ -8416,10 +8416,9 @@ aic7xxx_alloc(struct scsi_host_template *p = *temp; p->host = host; - p->scb_data =kmalloc (sizeof (scb_data_type),GFP_ATOMIC ); -if (p->scb_data !=NULL ) + p->scb_data =kzalloc (sizeof (scb_data_type),GFP_ATOMIC ); +if (!p->scb_data) { -memset (p->scb_data,0 ,sizeof (scb_data_type));scbq_init (&p->scb_data->free_scbs); }else
@@ -9196,10 +9195,9 @@ aic7xxx_detect(struct scsi_host_templateprintk (KERN_INFO " this driver, we are ignoring it.\n" ); } } -else if ( (temp_p =kmalloc (sizeof (struct aic7xxx_host ), +else if ( (temp_p =kzalloc (sizeof (struct aic7xxx_host ),GFP_ATOMIC )) !=NULL ) { -memset (temp_p,0 ,sizeof (struct aic7xxx_host )); temp_p->chip = aic_pdevs[i].chip |AHC_PCI ; temp_p->flags = aic_pdevs[i].flags; temp_p->features = aic_pdevs[i].features;
PATCH 1/1 drivers/sbus/char/bbc_envctrl.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/sbus/char/bbc_envctrl.c | 16622 -> 16580 (-42 bytes)
drivers/sbus/char/bbc_envctrl.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/sbus/char/bbc_envctrl.c +8 -6
@@ -479,11 +479,12 @@ static int kenvctrld(void *__unused)static void attach_one_temp (struct linux_ebus_child *echild,int temp_idx) { -struct bbc_cpu_temperature *tp =kmalloc (sizeof (*tp),GFP_KERNEL ); - +struct bbc_cpu_temperature *tp; + + tp =kzalloc (sizeof (*tp),GFP_KERNEL );if (!tp)return ; -memset (tp,0 ,sizeof (*tp)); + tp->client =bbc_i2c_attach (echild);if (!tp->client) {kfree (tp);
@@ -525,11 +526,12 @@ static void attach_one_temp(struct linuxstatic void attach_one_fan (struct linux_ebus_child *echild,int fan_idx) { -struct bbc_fan_control *fp =kmalloc (sizeof (*fp),GFP_KERNEL ); - +struct bbc_fan_control *fp; + + fp =kzalloc (sizeof (*fp),GFP_KERNEL );if (!fp)return ; -memset (fp,0 ,sizeof (*fp)); + fp->client =bbc_i2c_attach (echild);if (!fp->client) {kfree (fp);
David Miller
maintainerRe: [PATCH 03] drivers/sbus/char/bbc_envctrl.c: kmalloc + memset conversion to kzalloc
From: Mariusz Kozlowski <[email protected]>
Date: Tue, 31 Jul 2007 18:56:07 +0200
Quoted 1 line
Signed-off-by Mariusz Kozlowski <[email protected]>
Patch applied.
PATCH 1/1 drivers/sbus/char/bbc_i2c.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/sbus/char/bbc_i2c.c | 10847 -> 10823 (-24 bytes)
drivers/sbus/char/bbc_i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/sbus/char/bbc_i2c.c +2 -2
@@ -357,13 +357,13 @@ static void __init reset_one_i2c(structstatic int __init attach_one_i2c (struct linux_ebus_device *edev,int index) { -struct bbc_i2c_bus *bp =kmalloc (sizeof (*bp),GFP_KERNEL ); +struct bbc_i2c_bus *bp;struct linux_ebus_child *echild;int entry; + bp =kzalloc (sizeof (*bp),GFP_KERNEL );if (!bp)return -ENOMEM ; -memset (bp,0 ,sizeof (*bp)); bp->i2c_control_regs =ioremap (edev->resource[0 ].start,0x2 );if (!bp->i2c_control_regs)
David Miller
maintainerRe: [PATCH 04] drivers/sbus/char/bbc_i2c.c: kmalloc + memset conversion to kzalloc
From: Mariusz Kozlowski <[email protected]>
Date: Tue, 31 Jul 2007 18:58:05 +0200
Quoted 1 line
Signed-off-by Mariusz Kozlowski <[email protected]>
Patch applied, thanks.
PATCH 1/1 drivers/mmc/core/bus.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/mmc/core/bus.c | 5663 -> 5619 (-44 bytes) drivers/mmc/core/bus.o | 70899 -> 70731 (-168 bytes)
drivers/mmc/core/bus.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mmc/core/bus.c +1 -3
@@ -206,12 +206,10 @@ struct mmc_card *mmc_alloc_card(struct m {struct mmc_card *card; - card =kmalloc (sizeof (struct mmc_card ),GFP_KERNEL ); + card =kzalloc (sizeof (struct mmc_card ),GFP_KERNEL );if (!card)return ERR_PTR (-ENOMEM ); -memset (card,0 ,sizeof (struct mmc_card )); - card->host = host;device_initialize (&card->dev);
Re: [PATCH 05] drivers/mmc/core/bus.c: kmalloc + memset conversion to kzalloc
Quoted 8 lines · On Tue, 31 Jul 2007 18:59:59 +0200 Mariusz Kozlowski <[email protected]>…
Signed-off-by Mariusz Kozlowski <[email protected]>
drivers/mmc/core/bus.c| 5663 -> 5619 (-44 bytes)drivers/mmc/core/bus.o| 70899 -> 70731 (-168 bytes)drivers/mmc/core/bus.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
Signature · 5 lines
-- Pierre Ossman Linux kernel, MMC maintainer http://www.kernel.org PulseAudio, core developer http://pulseaudio.org rdesktop, core developer http://www.rdesktop.org
PATCH 1/1 drivers/scsi/bvme6000_scsi.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/scsi/bvme6000_scsi.c | 3330 -> 3253 (-77 bytes)
drivers/scsi/bvme6000_scsi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/scsi/bvme6000_scsi.c +3 -4
@@ -36,19 +36,18 @@ static struct platform_device *bvme6000_static __devinit int bvme6000_probe (struct device *dev) { -struct Scsi_Host * host =NULL ; +struct Scsi_Host *host;struct NCR_700_Host_Parameters *hostdata;if (!MACH_IS_BVME6000 ) goto out; - hostdata =kmalloc (sizeof (struct NCR_700_Host_Parameters ),GFP_KERNEL ); -if (hostdata =NULL ) { + hostdata =kzalloc (sizeof (struct NCR_700_Host_Parameters ),GFP_KERNEL ); +if (!hostdata) {printk (KERN_ERR "bvme6000-scsi: " "Failed to allocate host data\n" ); goto out; } -memset (hostdata,0 ,sizeof (struct NCR_700_Host_Parameters ));/* Fill in the required pieces of hostdata */ hostdata->base = (void __iomem *)BVME_NCR53C710_BASE ;
PATCH 1/1 drivers/block/cciss.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/block/cciss.c | 104285 -> 104168 (-117 bytes) drivers/block/cciss.o | 277400 -> 277124 (-276 bytes)
drivers/block/cciss.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/block/cciss.c +8 -8
@@ -1977,12 +1977,13 @@ cciss_read_capacity(int ctlr, int logvol {ReadCapdata_struct *buf;int return_code; - buf =kmalloc (sizeof (ReadCapdata_struct),GFP_KERNEL ); -if (buf =NULL ) { + + buf =kzalloc (sizeof (ReadCapdata_struct),GFP_KERNEL ); +if (!buf) {printk (KERN_WARNING "cciss: out of memory\n" );return ; } -memset (buf,0 ,sizeof (ReadCapdata_struct)); +if (withirq) return_code = sendcmd_withirq(CCISS_READ_CAPACITY, ctlr, buf, sizeof(ReadCapdata_struct),
@@ -2003,7 +2004,6 @@ cciss_read_capacity(int ctlr, int logvolprintk (KERN_INFO " blocks= %llu block_size= %d\n" , (unsigned long long )*total_size+1 , *block_size);kfree (buf); -return ; } static void
@@ -2011,12 +2011,13 @@ cciss_read_capacity_16(int ctlr, int log {ReadCapdata_struct_16 *buf;int return_code; - buf =kmalloc (sizeof (ReadCapdata_struct_16),GFP_KERNEL ); -if (buf =NULL ) { + + buf =kzalloc (sizeof (ReadCapdata_struct_16),GFP_KERNEL ); +if (!buf) {printk (KERN_WARNING "cciss: out of memory\n" );return ; } -memset (buf,0 ,sizeof (ReadCapdata_struct_16)); +if (withirq) { return_code = sendcmd_withirq(CCISS_READ_CAPACITY_16, ctlr, buf, sizeof(ReadCapdata_struct_16),
@@ -2038,7 +2039,6 @@ cciss_read_capacity_16(int ctlr, int logprintk (KERN_INFO " blocks= %llu block_size= %d\n" , (unsigned long long )*total_size+1 , *block_size);kfree (buf); -return ; }static int cciss_revalidate (struct gendisk *disk)
RE: [PATCH 07] drivers/block/cciss.c: kmalloc + memset conversion to kzalloc
Quoted 11 lines
-----Original Message-----
From: Mariusz Kozlowski [mailto:[email protected]]
Sent: Tuesday, July 31, 2007 12:04 PM
To: [email protected]
Cc: [email protected]; Andrew Morton; ISS StorageDev; [email protected]
Subject: [PATCH 07]drivers/block/cciss.c: kmalloc + memset conversion to kzalloc
Quoted 1 line
Signed-off-by Mariusz Kozlowski <[email protected]>
Quoted 62 lines
drivers/block/cciss.c| 104285 -> 104168 (-117 bytes)drivers/block/cciss.o| 277400 -> 277124 (-276 bytes)drivers/block/cciss.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)---
linux-2.6.23-rc1-mm1-a/drivers/block/cciss.c2007-07-26 13:07:41.000000000 +0200 +++ linux-2.6.23-rc1-mm1-b/drivers/block/cciss.c 2007-07-31 12:57:50.000000000 +0200drivers/block/cciss.c +4
-3@@ -1977,12 +1977,13 @@ cciss_read_capacity(int ctlr, int logvol {ReadCapdata_struct *buf;int return_code; - buf =kmalloc (sizeof (ReadCapdata_struct),GFP_KERNEL ); -if (buf =NULL ) { + + buf =kzalloc (sizeof (ReadCapdata_struct),GFP_KERNEL ); +if (!buf) {printk (KERN_WARNING "cciss: out of memory\n" );return ; } -memset (buf,0 ,sizeof (ReadCapdata_struct)); +if (withirq) return_code = sendcmd_withirq(CCISS_READ_CAPACITY, ctlr, buf,
sizeof(ReadCapdata_struct), @@ -2003,7 +2004,6 @@ cciss_read_capacity(int ctlr, int logvoldrivers/block/cciss.c +4
-4printk (KERN_INFO " blocks= %llu block_size= %d\n" , (unsigned long long )*total_size+1 , *block_size);kfree (buf); -return ; } static void@@ -2011,12 +2011,13 @@ cciss_read_capacity_16(int ctlr, int log {ReadCapdata_struct_16 *buf;int return_code; - buf =kmalloc (sizeof (ReadCapdata_struct_16),GFP_KERNEL ); -if (buf =NULL ) { + + buf =kzalloc (sizeof (ReadCapdata_struct_16),GFP_KERNEL ); +if (!buf) {printk (KERN_WARNING "cciss: out of memory\n" );return ; } -memset (buf,0 ,sizeof (ReadCapdata_struct_16)); +if (withirq) { return_code = sendcmd_withirq(CCISS_READ_CAPACITY_16, ctlr, buf,
sizeof(ReadCapdata_struct_16), @@ -2038,7 +2039,6 @@ cciss_read_capacity_16(int ctlr, int logdrivers/block/cciss.c +0
-1printk (KERN_INFO " blocks= %llu block_size= %d\n" , (unsigned long long )*total_size+1 , *block_size);kfree (buf); -return ; }static int cciss_revalidate (struct gendisk *disk)
PATCH 1/1 fs/cifs/connect.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz KozlowskiThis patch does kmalloc + memset conversion to kzalloc and removes some redundant argument checks.
fs/cifs/connect.c | 109282 -> 109078 (-204 bytes) fs/cifs/connect.o | 211804 -> 211576 (-228 bytes)
fs/cifs/connect.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-)
fs/cifs/connect.c +11 -19
@@ -676,10 +676,8 @@ multi_t2_fnd: server->ssocket =NULL ; }/* buffer usuallly freed in free_mid - need to free it here on exit */ -if (bigbuf !=NULL ) -cifs_buf_release (bigbuf); -if (smallbuf !=NULL ) -cifs_small_buf_release (smallbuf); +cifs_buf_release (bigbuf); +cifs_small_buf_release (smallbuf);read_lock (&GlobalSMBSeslock);if (list_empty (&server->pending_mid_q)) {
@@ -1909,8 +1907,8 @@ cifs_mount(struct super_block *sb, strucreturn rc; } - srvTcp =kmalloc (sizeof (struct TCP_Server_Info ),GFP_KERNEL ); -if (srvTcp =NULL ) { + srvTcp =kzalloc (sizeof (struct TCP_Server_Info ),GFP_KERNEL ); +if (!srvTcp) { rc = -ENOMEM ;sock_release (csocket);kfree (volume_info.UNC);
@@ -1919,7 +1917,6 @@ cifs_mount(struct super_block *sb, strucFreeXid (xid);return rc; }else { -memset (srvTcp,0 ,sizeof (struct TCP_Server_Info ));memcpy (&srvTcp->addr.sockAddr, &sin_server,sizeof (struct sockaddr_in ));atomic_set (&srvTcp->inFlight,0 );
@@ -2154,8 +2151,8 @@ cifs_mount(struct super_block *sb, struc } }/* If find_unc succeeded then rc = 0 so we can not end */ -if (tcon)/* up accidently freeing someone elses tcon struct */ -tconInfoFree (tcon); +/* up accidently freeing someone elses tcon struct */ +tconInfoFree (tcon);if (existingCifsSes =NULL ) {if (pSesInfo) { if ((pSesInfo->server) &&
@@ -2526,8 +2523,7 @@ CIFSSessSetup(unsigned int xid, struct c sesssetup_nomem:/* do not return an error on nomem for the info strings, since that could make reconnection harder, and reconnection might be needed to free memory */ -if (smb_buffer) -cifs_buf_release (smb_buffer); +cifs_buf_release (smb_buffer);return rc; }
@@ -2865,8 +2861,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned i rc = -EIO ; } -if (smb_buffer) -cifs_buf_release (smb_buffer); +cifs_buf_release (smb_buffer);return rc; }
@@ -3279,8 +3274,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xi rc = -EIO ; } -if (smb_buffer) -cifs_buf_release (smb_buffer); +cifs_buf_release (smb_buffer);return rc; }
@@ -3433,8 +3427,7 @@ CIFSTCon(unsigned int xid, struct cifsSe ses->ipc_tid = smb_buffer_response->Tid; } -if (smb_buffer) -cifs_buf_release (smb_buffer); +cifs_buf_release (smb_buffer);return rc; }
@@ -3485,8 +3478,7 @@ cifs_umount(struct super_block *sb, strukfree (tmp);if (ses)schedule_timeout_interruptible (msecs_to_jiffies (500 )); -if (ses) -sesInfoFree (ses); +sesInfoFree (ses);FreeXid (xid);return rc;/* BB check if we should always return zero here */
PATCH 1/1 drivers/char/consolemap.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/char/consolemap.c | 22678 -> 22650 (-28 bytes) drivers/char/consolemap.o | 90113 -> 90029 (-84 bytes)
drivers/char/consolemap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/char/consolemap.c +1 -2
@@ -494,12 +494,11 @@ int con_clear_unimap(struct vc_data *vc, p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;if (p && p->readonly)return -EIO ;if (!p || --p->refcount) { - q =kmalloc (sizeof (*p),GFP_KERNEL ); + q =kzalloc (sizeof (*p),GFP_KERNEL );if (!q) {if (p) p->refcount++;return -ENOMEM ; } -memset (q,0 ,sizeof (*q)); q->refcount=1 ; *vc->vc_uni_pagedir_loc = (unsigned long )q; }else {
Re: [PATCH 09] drivers/char/consolemap.c: kmalloc + memset conversion to kzalloc
Quoted 1 line · On Tue, 31 Jul 2007 19:08:28 +0200 Mariusz Kozlowski <[email protected]>…
Signed-off-by Mariusz Kozlowski <[email protected]>
PATCH 1/1 drivers/block/cpqarray.c: better error handling and kmalloc + memset conversion to k[cz]alloc
In reply to Mariusz KozlowskiThis patch removes some redundant casts, does the kmalloc + memset to k[cz]alloc conversion and it changes the error path to use goto (to avoid code duplication).
drivers/block/cpqarray.c | 49567 -> 48623 (-944 bytes) drivers/block/cpqarray.o | 178820 -> 178288 (-532 bytes)
drivers/block/cpqarray.c | 78 ++++++++++++------------------------- 1 file changed, 26 insertions(+), 52 deletions(-)
drivers/block/cpqarray.c +18 -50
@@ -420,18 +420,17 @@ static int __init cpqarray_register_ctlr goto Enomem2; } - hba[i]->cmd_pool = (cmdlist_t *)pci_alloc_consistent ( + hba[i]->cmd_pool =pci_alloc_consistent ( hba[i]->pci_dev,NR_CMDS *sizeof (cmdlist_t), &(hba[i]->cmd_pool_dhandle)); - hba[i]->cmd_pool_bits =kmalloc ( - ((NR_CMDS +BITS_PER_LONG -1 )/BITS_PER_LONG )*sizeof (unsigned long ), + hba[i]->cmd_pool_bits =kcalloc ( + (NR_CMDS +BITS_PER_LONG -1 )/BITS_PER_LONG ,sizeof (unsigned long ),GFP_KERNEL );if (!hba[i]->cmd_pool_bits || !hba[i]->cmd_pool) goto Enomem1;memset (hba[i]->cmd_pool,0 ,NR_CMDS *sizeof (cmdlist_t)); -memset (hba[i]->cmd_pool_bits,0 , ((NR_CMDS +BITS_PER_LONG -1 )/BITS_PER_LONG )*sizeof (unsigned long ));printk (KERN_INFO "cpqarray: Finding drives on %s" , hba[i]->devname);
@@ -1660,45 +1659,30 @@ static void getgeometry(int ctlr) info_p->log_drv_map =0 ; - id_ldrive =kmalloc (sizeof (id_log_drv_t),GFP_KERNEL ); -if (id_ldrive =NULL ) - { + id_ldrive =kzalloc (sizeof (id_log_drv_t),GFP_KERNEL ); +if (!id_ldrive) {printk (KERN_ERR "cpqarray: out of memory.\n" ); -return ; + goto err_0; } - id_ctlr_buf =kmalloc (sizeof (id_ctlr_t),GFP_KERNEL ); -if (id_ctlr_buf =NULL ) - { -kfree (id_ldrive); + id_ctlr_buf =kzalloc (sizeof (id_ctlr_t),GFP_KERNEL ); +if (!id_ctlr_buf) {printk (KERN_ERR "cpqarray: out of memory.\n" ); -return ; + goto err_1; } - id_lstatus_buf =kmalloc (sizeof (sense_log_drv_stat_t),GFP_KERNEL ); -if (id_lstatus_buf =NULL ) - { -kfree (id_ctlr_buf); -kfree (id_ldrive); + id_lstatus_buf =kzalloc (sizeof (sense_log_drv_stat_t),GFP_KERNEL ); +if (!id_lstatus_buf) {printk (KERN_ERR "cpqarray: out of memory.\n" ); -return ; + goto err_2; } - sense_config_buf =kmalloc (sizeof (config_t),GFP_KERNEL ); -if (sense_config_buf =NULL ) - { -kfree (id_lstatus_buf); -kfree (id_ctlr_buf); -kfree (id_ldrive); + sense_config_buf =kzalloc (sizeof (config_t),GFP_KERNEL ); +if (!sense_config_buf) {printk (KERN_ERR "cpqarray: out of memory.\n" ); -return ; + goto err_3; } -memset (id_ldrive,0 ,sizeof (id_log_drv_t)); -memset (id_ctlr_buf,0 ,sizeof (id_ctlr_t)); -memset (id_lstatus_buf,0 ,sizeof (sense_log_drv_stat_t)); -memset (sense_config_buf,0 ,sizeof (config_t)); - info_p->phys_drives =0 ; info_p->log_drv_map =0 ; info_p->drv_assign_map =0 ;
@@ -1712,13 +1696,8 @@ static void getgeometry(int ctlr)* so the idastubopen will fail on all logical drives * on the controller. */ -/* Free all the buffers and return */ printk (KERN_ERR "cpqarray: error sending ID controller\n" ); -kfree (sense_config_buf); -kfree (id_lstatus_buf); -kfree (id_ctlr_buf); -kfree (id_ldrive); -return ; + goto err_4; } info_p->log_drives = id_ctlr_buf->nr_drvs;
@@ -1764,12 +1743,7 @@ static void getgeometry(int ctlr)" failed to report status of logical drive %d\n" "Access to this controller has been disabled\n" , ctlr, log_unit); -/* Free all the buffers and return */ -kfree (sense_config_buf); -kfree (id_lstatus_buf); -kfree (id_ctlr_buf); -kfree (id_ldrive); -return ; + goto err_4; }/* Make sure the logical drive is configured
@@ -1798,14 +1772,8 @@ static void getgeometry(int ctlr) sizeof(config_t), 0, 0, log_unit);if (ret_code =IO_ERROR ) { info_p->log_drv_map =0 ; -/* Free all the buffers and return */ printk (KERN_ERR "cpqarray: error sending sense config\n" ); -kfree (sense_config_buf); -kfree (id_lstatus_buf); -kfree (id_ctlr_buf); -kfree (id_ldrive); -return ; - + goto err_4; } info_p->phys_drives @@ -1820,12 +1788,18 @@ static void getgeometry(int ctlr)
log_index = log_index + 1;
} /* end of if logical drive configured */
} /* end of for log_unit */
+
+ /* Free all the buffers and return */
+err_4:
kfree(sense_config_buf);
- kfree(id_ldrive);
+err_3:
kfree(id_lstatus_buf);
+err_2:
kfree(id_ctlr_buf);
+err_1:
+ kfree(id_ldrive);
+err_0:
return;
-
}
static void __exit cpqarray_exit(void)
RE: [PATCH 10] drivers/block/cpqarray.c: better error handling and kmalloc + memset conversion to k[cz]alloc
Quoted 11 lines
-----Original Message-----
From: Mariusz Kozlowski [mailto:[email protected]]
Sent: Tuesday, July 31, 2007 12:12 PM
To: [email protected]
Cc: [email protected]; Andrew Morton; ISS StorageDev; [email protected]
Subject: [PATCH 10]drivers/block/cpqarray.c: better error handling and kmalloc + memset conversion to k[cz]alloc
Quoted 5 lines
This patch removes some redundant casts, does the kmalloc + memset to k[cz]alloc conversion and it changes the error path to use goto (to avoid code duplication).
Signed-off-by Mariusz Kozlowski <[email protected]>
Quoted 167 lines
drivers/block/cpqarray.c| 49567 -> 48623 (-944 bytes)drivers/block/cpqarray.o| 178820 -> 178288 (-532 bytes)drivers/block/cpqarray.c | 78 ++++++++++++------------------------- 1 file changed, 26 insertions(+), 52 deletions(-)---
linux-2.6.23-rc1-mm1-a/drivers/block/cpqarray.c2007-07-26 13:07:41.000000000 +0200 +++ linux-2.6.23-rc1-mm1-b/drivers/block/cpqarray.c 2007-07-31 12:59:54.000000000 +0200drivers/block/cpqarray.c +3
-4@@ -420,18 +420,17 @@ static int __init cpqarray_register_ctlr goto Enomem2; } - hba[i]->cmd_pool = (cmdlist_t *)pci_alloc_consistent ( + hba[i]->cmd_pool =pci_alloc_consistent ( hba[i]->pci_dev,NR_CMDS *sizeof (cmdlist_t), &(hba[i]->cmd_pool_dhandle)); - hba[i]->cmd_pool_bits =kmalloc ( - ((NR_CMDS +BITS_PER_LONG -1 )/BITS_PER_LONG )*sizeof (unsigned long ), + hba[i]->cmd_pool_bits =kcalloc ( + (NR_CMDS +BITS_PER_LONG -1 )/BITS_PER_LONG ,sizeof (unsigned long ),GFP_KERNEL );if (!hba[i]->cmd_pool_bits || !hba[i]->cmd_pool) goto Enomem1;memset (hba[i]->cmd_pool,0 ,NR_CMDS *sizeof (cmdlist_t)); -memset (hba[i]->cmd_pool_bits,0 , ((NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG)*sizeof(unsigned long));drivers/block/cpqarray.c +12
-27printk (KERN_INFO "cpqarray: Finding drives on %s" , hba[i]->devname);@@ -1660,45 +1659,30 @@ static void getgeometry(int ctlr) info_p->log_drv_map =0 ; - id_ldrive =kmalloc (sizeof (id_log_drv_t),GFP_KERNEL ); -if (id_ldrive =NULL ) - { + id_ldrive =kzalloc (sizeof (id_log_drv_t),GFP_KERNEL ); +if (!id_ldrive) {printk (KERN_ERR "cpqarray: out of memory.\n" ); -return ; + goto err_0; } - id_ctlr_buf =kmalloc (sizeof (id_ctlr_t),GFP_KERNEL ); -if (id_ctlr_buf =NULL ) - { -kfree (id_ldrive); + id_ctlr_buf =kzalloc (sizeof (id_ctlr_t),GFP_KERNEL ); +if (!id_ctlr_buf) {printk (KERN_ERR "cpqarray: out of memory.\n" ); -return ; + goto err_1; } - id_lstatus_buf =kmalloc (sizeof (sense_log_drv_stat_t), GFP_KERNEL); -if (id_lstatus_buf =NULL ) - { -kfree (id_ctlr_buf); -kfree (id_ldrive); + id_lstatus_buf =kzalloc (sizeof (sense_log_drv_stat_t),GFP_KERNEL ); +if (!id_lstatus_buf) {printk (KERN_ERR "cpqarray: out of memory.\n" ); -return ; + goto err_2; } - sense_config_buf =kmalloc (sizeof (config_t),GFP_KERNEL ); -if (sense_config_buf =NULL ) - { -kfree (id_lstatus_buf); -kfree (id_ctlr_buf); -kfree (id_ldrive); + sense_config_buf =kzalloc (sizeof (config_t),GFP_KERNEL ); +if (!sense_config_buf) {printk (KERN_ERR "cpqarray: out of memory.\n" ); -return ; + goto err_3; } -memset (id_ldrive,0 ,sizeof (id_log_drv_t)); -memset (id_ctlr_buf,0 ,sizeof (id_ctlr_t)); -memset (id_lstatus_buf,0 ,sizeof (sense_log_drv_stat_t)); -memset (sense_config_buf,0 ,sizeof (config_t)); - info_p->phys_drives =0 ;drivers/block/cpqarray.c +1
-6info_p->log_drv_map =0 ; info_p->drv_assign_map =0 ;@@ -1712,13 +1696,8 @@ static void getgeometry(int ctlr)* so the idastubopen will fail on all logical drives * on the controller. */ -/* Free all the buffers and return */ printk (KERN_ERR "cpqarray: error sending ID controller\n"); -kfree (sense_config_buf); -kfree (id_lstatus_buf); -kfree (id_ctlr_buf); -kfree (id_ldrive); -return ; + goto err_4; }(quoted diff) +1
-0info_p->log_drives = id_ctlr_buf->nr_drvs; @@ -1764,12 +1743,7 @@ static void getgeometry(int ctlr) " failed to report status oflogical drive %d\n"
"Access to this controller has been
disabled\n",drivers/block/cpqarray.c +1
-8ctlr, log_unit); -/* Free all the buffers and return */ -kfree (sense_config_buf); -kfree (id_lstatus_buf); -kfree (id_ctlr_buf); -kfree (id_ldrive); -return ; + goto err_4; }/* Make sure the logical drive is configured @@ -1798,14 +1772,8 @@ static void getgeometry(int ctlr) sizeof(config_t), 0, 0, log_unit); if (ret_code = IO_ERROR) { info_p->log_drv_map = 0; -/* Free all the buffers and return */
printk(KERN_ERR
"cpqarray: error sending sense config\n");(quoted diff) +9
-8- kfree(sense_config_buf); - kfree(id_lstatus_buf); - kfree(id_ctlr_buf); - kfree(id_ldrive); - return; - + goto err_4; } info_p->phys_drives > @@ -1820,12 +1788,18 @@ static void getgeometry(int ctlr) log_index = log_index + 1; } /* end of if logical drive configured */ } /* end of for log_unit */ + + /* Free all the buffers and return */ +err_4: kfree(sense_config_buf); - kfree(id_ldrive); +err_3: kfree(id_lstatus_buf); +err_2: kfree(id_ctlr_buf); +err_1: + kfree(id_ldrive); +err_0: return; - } static void __exit cpqarray_exit(void)
PATCH 1/1 drivers/pci/hotplug/cpqphp_ctrl.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/pci/hotplug/cpqphp_ctrl.c | 79698 -> 79638 (-60 bytes) drivers/pci/hotplug/cpqphp_ctrl.o | 192896 -> 192736 (-160 bytes)
drivers/pci/hotplug/cpqphp_ctrl.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/pci/hotplug/cpqphp_ctrl.c +3 -6
@@ -973,16 +973,13 @@ struct pci_func *cpqhp_slot_create(u8 bustruct pci_func *new_slot;struct pci_func *next; - new_slot =kmalloc (sizeof (*new_slot),GFP_KERNEL ); - -if (new_slot =NULL ) { + new_slot =kzalloc (sizeof (*new_slot),GFP_KERNEL ); +if (!new_slot) {/* I'm not dead yet! * You will be. */ -return new_slot; +return NULL ; } -memset (new_slot,0 ,sizeof (struct pci_func )); - new_slot->next =NULL ; new_slot->configured =1 ;
PATCH 1/1 fs/reiser4/plugin/file/cryptcompress.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski fs/reiser4/plugin/file/cryptcompress.c | 101386 -> 101352 (-34 bytes) fs/reiser4/plugin/file/cryptcompress.o | 456784 -> 456644 (-140 bytes)
fs/reiser4/plugin/file/cryptcompress.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/reiser4/plugin/file/cryptcompress.c +3 -3
@@ -74,13 +74,13 @@ static void set_inode_crypto_info (struc/* allocate a cipher key info */ struct reiser4_crypto_info *reiser4_alloc_crypto_info (struct inode * inode) { -struct reiser4_crypto_info * info; +struct reiser4_crypto_info *info;int fipsize; - info =kmalloc (sizeof (*info),reiser4_ctx_gfp_mask_get ()); + info =kzalloc (sizeof (*info),reiser4_ctx_gfp_mask_get ());if (!info)return ERR_PTR (-ENOMEM ); -memset (info,0 ,sizeof (*info)); + fipsize =inode_digest_plugin (inode)->fipsize; info->keyid =kmalloc (fipsize,reiser4_ctx_gfp_mask_get ());if (!info->keyid) {
PATCH 1/1 kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowskifs/reiser4/plugin/file/cryptcompress.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
fs/reiser4/plugin/file/cryptcompress.h +2 -3
@@ -83,10 +83,9 @@ static inline int alloc_ts(struct tfm_stassert ("edward-931" , stm);assert ("edward-932" , *stm =NULL ); - *stm =kmalloc (sizeof **stm,reiser4_ctx_gfp_mask_get ()); -if (*stm =NULL ) + *stm =kzalloc (sizeof (**stm),reiser4_ctx_gfp_mask_get ()); +if (!*stm)return -ENOMEM ; -memset (*stm,0 ,sizeof **stm);return 0 ; }
PATCH 1/1 kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski fs/reiser4/plugin/item/ctail.c | 41897 -> 41859 (-38 bytes) fs/reiser4/plugin/item/ctail.o | 306180 -> 305904 (-276 bytes)
fs/reiser4/plugin/item/ctail.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/reiser4/plugin/item/ctail.c +2 -2
@@ -1148,10 +1148,10 @@ static int alloc_convert_data(flush_pos_assert ("edward-821" , pos !=NULL );assert ("edward-822" , pos->sq =NULL ); - pos->sq =kmalloc (sizeof (*pos->sq),reiser4_ctx_gfp_mask_get ()); + pos->sq =kzalloc (sizeof (*pos->sq),reiser4_ctx_gfp_mask_get ());if (!pos->sq)return RETERR (-ENOMEM ); -memset (pos->sq,0 ,sizeof (*pos->sq)); +cluster_init_write (&pos->sq->clust,NULL );return 0 ; }
PATCH 1/1 kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/md/dm-emc.c | 8547 -> 8518 (-29 bytes) drivers/md/dm-emc.o | 107484 -> 107416 (-68 bytes)
drivers/md/dm-emc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/md/dm-emc.c +3 -4
@@ -224,12 +224,11 @@ fail_path:static struct emc_handler *alloc_emc_handler (void ) { -struct emc_handler *h =kmalloc (sizeof (*h),GFP_KERNEL ); +struct emc_handler *h; -if (h) { -memset (h,0 ,sizeof (*h)); + h =kzalloc (sizeof (*h),GFP_KERNEL ); +if (h)spin_lock_init (&h->lock); - }return h; }
PATCH 1/1 drivers/md/dm-hw-handler.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/md/dm-hw-handler.c | 4424 -> 4393 (-31 bytes) drivers/md/dm-hw-handler.o | 101828 -> 101652 (-176 bytes)
drivers/md/dm-hw-handler.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/md/dm-hw-handler.c +4 -5
@@ -91,12 +91,11 @@ void dm_put_hw_handler(struct hw_handlerstatic struct hwh_internal *_alloc_hw_handler (struct hw_handler_type *hwht) { -struct hwh_internal *hwhi =kmalloc (sizeof (*hwhi),GFP_KERNEL ); - -if (hwhi) { -memset (hwhi,0 ,sizeof (*hwhi)); +struct hwh_internal *hwhi; + + hwhi =kzalloc (sizeof (*hwhi),GFP_KERNEL ); +if (hwhi) hwhi->hwht = *hwht; - }return hwhi; }
PATCH 1/1 drivers/md/dm-path-selector.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/md/dm-path-selector.c | 2666 -> 2636 (-30 bytes) drivers/md/dm-path-selector.o | 101207 -> 101031 (-176 bytes)
drivers/md/dm-path-selector.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/md/dm-path-selector.c +4 -5
@@ -94,12 +94,11 @@ out:static struct ps_internal *_alloc_path_selector (struct path_selector_type *pst) { -struct ps_internal *psi =kmalloc (sizeof (*psi),GFP_KERNEL ); - -if (psi) { -memset (psi,0 ,sizeof (*psi)); +struct ps_internal *psi; + + psi =kzalloc (sizeof (*psi),GFP_KERNEL ); +if (psi) psi->pst = *pst; - }return psi; }
PATCH 1/1 drivers/md/dm-table.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/md/dm-table.c | 21698 -> 21664 (-34 bytes) drivers/md/dm-table.o | 132153 -> 132093 (-60 bytes)
drivers/md/dm-table.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/md/dm-table.c +3 -4
@@ -213,12 +213,12 @@ static int alloc_targets(struct dm_tableint dm_table_create (struct dm_table **result,int mode,unsigned num_targets,struct mapped_device *md) { -struct dm_table *t =kmalloc (sizeof (*t),GFP_KERNEL ); - +struct dm_table *t; + + t =kzalloc (sizeof (*t),GFP_KERNEL );if (!t)return -ENOMEM ; -memset (t,0 ,sizeof (*t));INIT_LIST_HEAD (&t->devices);atomic_set (&t->holders,1 );
@@ -229,7 +229,6 @@ int dm_table_create(struct dm_table **reif (alloc_targets (t, num_targets)) {kfree (t); - t =NULL ;return -ENOMEM ; }
PATCH 1/1 drivers/md/dm-target.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/md/dm-target.c | 3300 -> 3271 (-29 bytes) drivers/md/dm-target.o | 105641 -> 105449 (-192 bytes)
drivers/md/dm-target.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/md/dm-target.c +4 -5
@@ -88,12 +88,11 @@ void dm_put_target_type(struct target_tystatic struct tt_internal *alloc_target (struct target_type *t) { -struct tt_internal *ti =kmalloc (sizeof (*ti),GFP_KERNEL ); - -if (ti) { -memset (ti,0 ,sizeof (*ti)); +struct tt_internal *ti; + + ti =kzalloc (sizeof (*ti),GFP_KERNEL ); +if (ti) ti->tt = *t; - }return ti; }
PATCH 1/1 net/decnet/dn_route.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski net/decnet/dn_route.c | 45013 -> 44991 (-22 bytes) net/decnet/dn_route.o | 199388 -> 199580 (+192 bytes)
net/decnet/dn_route.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/decnet/dn_route.c +3 -3
@@ -1737,8 +1737,9 @@ static int dn_rt_cache_seq_open(struct i {struct seq_file *seq;int rc = -ENOMEM ; -struct dn_rt_cache_iter_state *s =kmalloc (sizeof (*s),GFP_KERNEL ); - +struct dn_rt_cache_iter_state *s; + + s =kzalloc (sizeof (*s),GFP_KERNEL );if (!s) goto out; rc =seq_open (file, &dn_rt_cache_seq_ops);
@@ -1746,7 +1747,6 @@ static int dn_rt_cache_seq_open(struct i goto out_kfree; seq = file->private_data; seq->private = s; -memset (s,0 ,sizeof (*s)); out:return rc; out_kfree:
David Miller
maintainerRe: [PATCH 20] net/decnet/dn_route.c: kmalloc + memset conversion to kzalloc
From: Mariusz Kozlowski <[email protected]>
Date: Tue, 31 Jul 2007 19:33:33 +0200
Quoted 1 line
Signed-off-by Mariusz Kozlowski <[email protected]>
Patch applied, thanks.
PATCH 1/1 drivers/scsi/dpt_i2o.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/scsi/dpt_i2o.c | 87632 -> 87457 (-175 bytes) drivers/scsi/dpt_i2o.o | 213064 -> 212324 (-740 bytes)
drivers/scsi/dpt_i2o.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-)
drivers/scsi/dpt_i2o.c +11 -16
@@ -950,16 +950,14 @@ static int adpt_install_hba(struct scsi_ }// Allocate and zero the data structure - pHba =kmalloc (sizeof (adpt_hba),GFP_KERNEL ); -if ( pHba =NULL ) { -if (msg_addr_virt != base_addr_virt){ + pHba =kzalloc (sizeof (adpt_hba),GFP_KERNEL ); +if (!pHba) { +if (msg_addr_virt != base_addr_virt)iounmap (msg_addr_virt); - }iounmap (base_addr_virt);pci_release_regions (pDev);return -ENOMEM ; } -memset (pHba,0 ,sizeof (adpt_hba));mutex_lock (&adpt_configuration_lock);
@@ -2667,14 +2665,13 @@ static s32 adpt_i2o_init_outbound_q(adpt msg=(u32 __iomem *)(pHba->msg_addr_virt+m); - status =kmalloc (4 ,GFP_KERNEL |ADDR32 ); -if (status=NULL ) { + status =kzalloc (4 ,GFP_KERNEL |ADDR32 ); +if (!status) {adpt_send_nop (pHba, m);printk (KERN_WARNING "%s: IOP reset failed - no free memory.\n" , pHba->name);return -ENOMEM ; } -memset (status,0 ,4 );writel (EIGHT_WORD_MSG_SIZE |SGL_OFFSET_6 , &msg[0 ]);writel (I2O_CMD_OUTBOUND_INIT <<24 |HOST_TID <<12 |ADAPTER_TID , &msg[1 ]);
@@ -2713,12 +2710,11 @@ static s32 adpt_i2o_init_outbound_q(adptkfree (pHba->reply_pool); - pHba->reply_pool =kmalloc (pHba->reply_fifo_size *REPLY_FRAME_SIZE *4 ,GFP_KERNEL |ADDR32 ); -if (!pHba->reply_pool){ -printk (KERN_ERR "%s: Could not allocate reply pool\n" ,pHba->name); -return -1 ; + pHba->reply_pool =kzalloc (pHba->reply_fifo_size *REPLY_FRAME_SIZE *4 ,GFP_KERNEL |ADDR32 ); +if (!pHba->reply_pool) { +printk (KERN_ERR "%s: Could not allocate reply pool\n" , pHba->name); +return -ENOMEM ; } -memset (pHba->reply_pool,0 , pHba->reply_fifo_size *REPLY_FRAME_SIZE *4 ); ptr = pHba->reply_pool;for (i =0 ; i < pHba->reply_fifo_size; i++) {
@@ -2929,12 +2925,11 @@ static int adpt_i2o_build_sys_table(voidkfree (sys_tbl); - sys_tbl =kmalloc (sys_tbl_len,GFP_KERNEL |ADDR32 ); -if (!sys_tbl) { + sys_tbl =kzalloc (sys_tbl_len,GFP_KERNEL |ADDR32 ); +if (!sys_tbl) {printk (KERN_WARNING "SysTab Set failed. Out of memory.\n" );return -ENOMEM ; } -memset (sys_tbl,0 , sys_tbl_len); sys_tbl->num_entries = hba_count; sys_tbl->version =I2OVERSION ;
RE: [PATCH 21] drivers/scsi/dpt_i2o.c: kmalloc + memset conversion to kzalloc
ACK
Looks good and ultra-light on side effects!
Sincerely -- Mark Salyzyn
Quoted 16 lines
-----Original Message-----
From: Mariusz Kozlowski [mailto:[email protected]]
Sent: Tuesday, July 31, 2007 1:35 PM
To: [email protected]
Cc: [email protected]; Andrew Morton; [email protected]; AACRAID
Subject: [PATCH 21]drivers/scsi/dpt_i2o.c: kmalloc + memset conversion to kzallocSigned-off-by Mariusz Kozlowski <[email protected]>
drivers/scsi/dpt_i2o.c| 87632 -> 87457 (-175 bytes)drivers/scsi/dpt_i2o.o| 213064 -> 212324 (-740 bytes)drivers/scsi/dpt_i2o.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-)
PATCH 1/1 drivers/net/e1000new/ethtool.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/net/e1000new/ethtool.c | 58607 -> 58527 (-80 bytes) drivers/net/e1000new/ethtool.o | 197636 -> 197312 (-324 bytes)
drivers/net/e1000new/ethtool.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/e1000new/ethtool.c +2 -4
@@ -1031,12 +1031,11 @@ static int e1000_setup_desc_rings(struct tx_ring->count =E1000_DEFAULT_TXD ; size = tx_ring->count *sizeof (struct e1000_buffer ); - tx_ring->buffer_info =kmalloc (size,GFP_KERNEL ); + tx_ring->buffer_info =kzalloc (size,GFP_KERNEL );if (!tx_ring->buffer_info) { ret_val =1 ; goto err_nomem; } -memset (tx_ring->buffer_info,0 , size); tx_ring->size = tx_ring->count *sizeof (struct e1000_tx_desc ); tx_ring->size =ALIGN (tx_ring->size,4096 );
@@ -1092,12 +1091,11 @@ static int e1000_setup_desc_rings(struct rx_ring->count =E1000_DEFAULT_RXD ; size = rx_ring->count *sizeof (struct e1000_buffer ); - rx_ring->buffer_info =kmalloc (size,GFP_KERNEL ); + rx_ring->buffer_info =kzalloc (size,GFP_KERNEL );if (!rx_ring->buffer_info) { ret_val =4 ; goto err_nomem; } -memset (rx_ring->buffer_info,0 , size); rx_ring->size = rx_ring->count *sizeof (struct e1000_rx_desc ); rx_ring->desc = pci_alloc_consistent(pdev, rx_ring->size,
PATCH 1/1 doc firmware_sample_firmware_class.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski Documentation/firmware_class/firmware_sample_firmware_class.c | 5246 -> 5211 (-35 bytes)
Documentation/firmware_class/firmware_sample_firmware_class.c | 12 +++++----- 1 file changed, 6 insertions(+), 6 deletions(-)
Documentation/firmware_class/firmware_sample_firmware_class.c +6 -6
@@ -109,15 +109,15 @@ static int fw_setup_class_device(structconst char *fw_name, struct device *device) { - int retval = 0; -struct firmware_priv *fw_priv =kmalloc (sizeof (struct firmware_priv ), -GFP_KERNEL ); - -if (!fw_priv){ + int retval; +struct firmware_priv *fw_priv; + + fw_priv =kzalloc (sizeof (struct firmware_priv ),GFP_KERNEL ); +if (!fw_priv) { retval = -ENOMEM ; goto out; } -memset (fw_priv,0 ,sizeof (*fw_priv)); +memset (class_dev,0 ,sizeof (*class_dev));strncpy (fw_priv->fw_id, fw_name,FIRMWARE_NAME_MAX );
PATCH 1/1 include/asm-frv/thread_info.h: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowskiinclude/asm-frv/thread_info.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
include/asm-frv/thread_info.h +2 -3
@@ -88,9 +88,8 @@ register struct thread_info *__current_t ({ \struct thread_info *ret; \ \ - ret =kmalloc (THREAD_SIZE ,GFP_KERNEL ); \ -if (ret) \ -memset (ret,0 ,THREAD_SIZE ); \ + ret =kzalloc (THREAD_SIZE ,GFP_KERNEL ); \ + \ ret; \ }) #else
Re: [PATCH 24] include/asm-frv/thread_info.h: kmalloc + memset conversion to kzalloc
PATCH 1/1 drivers/usb/misc/ftdi-elan.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/usb/misc/ftdi-elan.c | 121253 -> 121196 (-57 bytes) drivers/usb/misc/ftdi-elan.o | 209425 -> 209265 (-160 bytes)
drivers/usb/misc/ftdi-elan.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/usb/misc/ftdi-elan.c +5 -3
@@ -2777,12 +2777,14 @@ static int ftdi_elan_probe(struct usb_insize_t buffer_size;int i;int retval = -ENOMEM ; -struct usb_ftdi *ftdi =kmalloc (sizeof (struct usb_ftdi ),GFP_KERNEL ); -if (ftdi =NULL ) { +struct usb_ftdi *ftdi; + + ftdi =kzalloc (sizeof (struct usb_ftdi ),GFP_KERNEL ); +if (!ftdi) {printk (KERN_ERR "Out of memory\n" );return -ENOMEM ; } -memset (ftdi,0x00 ,sizeof (struct usb_ftdi )); +mutex_lock (&ftdi_module_lock);list_add_tail (&ftdi->ftdi_list, &ftdi_static_list); ftdi->sequence_num = ++ftdi_instances;
Re: [PATCH 25] drivers/usb/misc/ftdi-elan.c: kmalloc + memset conversion to kzalloc
drivers/usb/misc/ftdi-elan.c static int ftdi_elan_probe(struct usb_in · line 2783
Quoted 10 lines · Mariusz Kozlowski
drivers/usb/misc/ftdi-elan.c +4
-2@@ -2777,12 +2777,14 @@ static int ftdi_elan_probe(struct usb_insize_t buffer_size;int i;int retval = -ENOMEM ; -struct usb_ftdi *ftdi =kmalloc (sizeof (struct usb_ftdi ),GFP_KERNEL ); -if (ftdi =NULL ) { +struct usb_ftdi *ftdi; + + ftdi =kzalloc (sizeof (struct usb_ftdi ),GFP_KERNEL ); +if (!ftdi) {
Whitespace damage soewhere?
PATCH 1/1 drivers/scsi/gdth.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/scsi/gdth.c | 189401 -> 189342 (-59 bytes) drivers/scsi/gdth.o | 331028 -> 330324 (-704 bytes)
drivers/scsi/gdth.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/gdth.c +4 -4
@@ -458,10 +458,10 @@ int __gdth_execute(struct scsi_device *sDECLARE_COMPLETION_ONSTACK (wait);int rval; - scp =kmalloc (sizeof (*scp),GFP_KERNEL ); + scp =kzalloc (sizeof (*scp),GFP_KERNEL );if (!scp)return -ENOMEM ; -memset (scp,0 ,sizeof (*scp)); + scp->device = sdev;/* use request field to save the ptr. to completion struct. */ scp->request = (struct request *)&wait;
@@ -5273,10 +5273,10 @@ static int gdth_ioctl(struct inode *inod hanum = res.ionode; ha =gdth_find_ha (hanum); - scp =kmalloc (sizeof (*scp),GFP_KERNEL ); + scp =kzalloc (sizeof (*scp),GFP_KERNEL );if (!scp)return -ENOMEM ; -memset (scp,0 ,sizeof (*scp)); + scp->device = ha->sdev; scp->cmd_len =12 ; scp->use_sg =0 ;
PATCH 1/1 drivers/input/serio/gscps2.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/input/serio/gscps2.c | 11696 -> 11607 (-89 bytes)
drivers/input/serio/gscps2.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/input/serio/gscps2.c +2 -4
@@ -340,8 +340,8 @@ static int __init gscps2_probe(struct paif (dev->id.sversion =0x96 ) hpa +=GSC_DINO_OFFSET ; - ps2port =kmalloc (sizeof (struct gscps2port ),GFP_KERNEL ); - serio =kmalloc (sizeof (struct serio ),GFP_KERNEL ); + ps2port =kzalloc (sizeof (struct gscps2port ),GFP_KERNEL ); + serio =kzalloc (sizeof (struct serio ),GFP_KERNEL );if (!ps2port || !serio) { ret = -ENOMEM ; goto fail_nomem;
@@ -349,8 +349,6 @@ static int __init gscps2_probe(struct padev_set_drvdata (&dev->dev, ps2port); -memset (ps2port,0 ,sizeof (struct gscps2port )); -memset (serio,0 ,sizeof (struct serio )); ps2port->port = serio; ps2port->padev = dev; ps2port->addr =ioremap_nocache (hpa,GSC_STATUS +4 );
PATCH 1/1 drivers/net/wan/hdlc_fr.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/net/wan/hdlc_fr.c | 31260 -> 31223 (-37 bytes) drivers/net/wan/hdlc_fr.o | 144872 -> 144728 (-144 bytes)
drivers/net/wan/hdlc_fr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wan/hdlc_fr.c +1 -2
@@ -212,14 +212,13 @@ static pvc_device* add_pvc(struct net_de pvc_p = &(*pvc_p)->next; } - pvc =kmalloc (sizeof (pvc_device),GFP_ATOMIC ); + pvc =kzalloc (sizeof (pvc_device),GFP_ATOMIC );#ifdef DEBUG_PVC printk (KERN_DEBUG "add_pvc: allocated pvc %p, frad %p\n" , pvc, dev);#endif if (!pvc)return NULL ; -memset (pvc,0 ,sizeof (pvc_device)); pvc->dlci = dlci; pvc->frad = dev; pvc->next = *pvc_p;/* Put it in the chain */
Krzysztof Halasa
maintainerRe: [PATCH 28] drivers/net/wan/hdlc_fr.c: kmalloc + memset conversion to kzalloc
Quoted 4 lines · Mariusz Kozlowski
+++
linux-2.6.23-rc1-mm1-b/drivers/net/wan/hdlc_fr.c2007-07-30 00:25:40.000000000 +0200drivers/net/wan/hdlc_fr.c +0
-0@@ -212,14 +212,13 @@ static pvc_device* add_pvc(struct net_de pvc_p = &(*pvc_p)->next; }
drivers/net/wan/hdlc_fr.c static pvc_device* add_pvc(struct net_de · line 222
Quoted 10 lines
drivers/net/wan/hdlc_fr.c +1
-2- pvc =kmalloc (sizeof (pvc_device),GFP_ATOMIC ); + pvc =kzalloc (sizeof (pvc_device),GFP_ATOMIC );#ifdef DEBUG_PVC printk (KERN_DEBUG "add_pvc: allocated pvc %p, frad %p\n" , pvc, dev);#endif if (!pvc)return NULL ; -memset (pvc,0 ,sizeof (pvc_device));
Looks good, thanks.
Signature · 1 line
Krzysztof Halasa
PATCH 1/1 drivers/mmc/core/host.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/mmc/core/host.c | 3509 -> 3457 (-52 bytes) drivers/mmc/core/host.o | 92400 -> 92136 (-264 bytes)
drivers/mmc/core/host.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mmc/core/host.c +1 -3
@@ -58,12 +58,10 @@ struct mmc_host *mmc_alloc_host(int extr {struct mmc_host *host; - host =kmalloc (sizeof (struct mmc_host ) + extra,GFP_KERNEL ); + host =kzalloc (sizeof (struct mmc_host ) + extra,GFP_KERNEL );if (!host)return NULL ; -memset (host,0 ,sizeof (struct mmc_host ) + extra); - host->parent = dev; host->class_dev.parent = dev; host->class_dev.class = &mmc_host_class;
Re: [PATCH 29] drivers/mmc/core/host.c: kmalloc + memset conversion to kzalloc
Quoted 8 lines · On Tue, 31 Jul 2007 19:53:16 +0200 Mariusz Kozlowski <[email protected]>…
Signed-off-by Mariusz Kozlowski <[email protected]>
drivers/mmc/core/host.c| 3509 -> 3457 (-52 bytes)drivers/mmc/core/host.o| 92400 -> 92136 (-264 bytes)drivers/mmc/core/host.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
Signature · 5 lines
-- Pierre Ossman Linux kernel, MMC maintainer http://www.kernel.org PulseAudio, core developer http://pulseaudio.org rdesktop, core developer http://www.rdesktop.org
PATCH 1/1 drivers/ide/arm/icside.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz KozlowskiIs this a bug? In original verison memset cleared sizeof(state) bytes instead of sizeof(*state). If it was intentional then this patch is invalid. If not intentional -> valid :) Please review.
drivers/ide/arm/icside.c | 18883 -> 18849 (-34 bytes)
drivers/ide/arm/icside.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/ide/arm/icside.c +1 -2
@@ -682,13 +682,12 @@ icside_probe(struct expansion_card *ec,if (ret) goto out; - state =kmalloc (sizeof (struct icside_state ),GFP_KERNEL ); + state =kzalloc (sizeof (struct icside_state ),GFP_KERNEL );if (!state) { ret = -ENOMEM ; goto release; } -memset (state,0 ,sizeof (state)); state->type =ICS_TYPE_NOTYPE ; state->dev = &ec->dev;
Bartlomiej Zolnierkiewicz
AppliedRe: [PATCH 30] drivers/ide/arm/icside.c: kmalloc + memset conversion to kzalloc
Quoted 3 lines · Mariusz Kozlowski
Is this a bug? In original verison memset cleared sizeof(state) bytes instead of
sizeof(*state). If it was intentional then this patch is invalid. If not intentional -> valid :) Please review.
Yes, it is a bug so this patch is a valid bugfix. :-)
Quoted 6 lines
Signed-off-by Mariusz Kozlowski <[email protected]>
drivers/ide/arm/icside.c| 18883 -> 18849 (-34 bytes)drivers/ide/arm/icside.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
applied
Quoted 17 lines
drivers/ide/arm/icside.c +1
-2@@ -682,13 +682,12 @@ icside_probe(struct expansion_card *ec,if (ret) goto out; - state =kmalloc (sizeof (struct icside_state ),GFP_KERNEL ); + state =kzalloc (sizeof (struct icside_state ),GFP_KERNEL );if (!state) { ret = -ENOMEM ; goto release; } -memset (state,0 ,sizeof (state)); state->type =ICS_TYPE_NOTYPE ; state->dev = &ec->dev;
PATCH 1/1 drivers/scsi/ide-scsi.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/scsi/ide-scsi.c | 34642 -> 34536 (-106 bytes) drivers/scsi/ide-scsi.o | 171728 -> 171524 (-204 bytes)
drivers/scsi/ide-scsi.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/scsi/ide-scsi.c +4 -6
@@ -328,17 +328,15 @@ static int idescsi_check_condition(ide_du8 *buf;/* stuff a sense request in front of our current request */ - pc =kmalloc (sizeof (idescsi_pc_t),GFP_ATOMIC ); - rq =kmalloc (sizeof (struct request ),GFP_ATOMIC ); - buf =kmalloc (SCSI_SENSE_BUFFERSIZE ,GFP_ATOMIC ); -if (pc =NULL || rq =NULL || buf =NULL ) { + pc =kzalloc (sizeof (idescsi_pc_t),GFP_ATOMIC ); + rq =kmalloc (sizeof (struct request ),GFP_ATOMIC ); + buf =kzalloc (SCSI_SENSE_BUFFERSIZE ,GFP_ATOMIC ); +if (!pc || !rq || !buf) {kfree (buf);kfree (rq);kfree (pc);return -ENOMEM ; } -memset (pc,0 ,sizeof (idescsi_pc_t)); -memset (buf,0 ,SCSI_SENSE_BUFFERSIZE );ide_init_drive_cmd (rq); rq->special = (char *) pc; pc->rq = rq;
Bartlomiej Zolnierkiewicz
AppliedRe: [PATCH 31] drivers/scsi/ide-scsi.c: kmalloc + memset conversion to kzalloc
Quoted 7 lines · Mariusz Kozlowski
Signed-off-by Mariusz Kozlowski <[email protected]>
drivers/scsi/ide-scsi.c| 34642 -> 34536 (-106 bytes)drivers/scsi/ide-scsi.o| 171728 -> 171524 (-204 bytes)drivers/scsi/ide-scsi.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
applied
PATCH 32] drivers/mtd/inftlmount.c: kmalloc + memset conversion to kcalloc
In reply to Mariusz Kozlowski drivers/mtd/inftlmount.c | 23841 -> 23803 (-38 bytes) drivers/mtd/inftlmount.o | 47196 -> 46956 (-240 bytes)
drivers/mtd/inftlmount.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/inftlmount.c +1 -2
@@ -580,14 +580,13 @@ int INFTL_mount(struct INFTLrecord *s) logical_block = block =BLOCK_NIL ;/* Temporary buffer to store ANAC numbers. */ - ANACtable =kmalloc (s->nb_blocks *sizeof (u8),GFP_KERNEL ); + ANACtable =kcalloc (s->nb_blocks,sizeof (u8),GFP_KERNEL );if (!ANACtable) {printk (KERN_WARNING "INFTL: allocation of ANACtable " "failed (%zd bytes)\n" , s->nb_blocks *sizeof (u8));return -ENOMEM ; } -memset (ANACtable,0 , s->nb_blocks);/* * First pass is to explore each physical unit, and construct the
PATCH 1/1 fs/reiser4/init_super.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski fs/reiser4/init_super.c | 19283 -> 19246 (-37 bytes) fs/reiser4/init_super.o | 155348 -> 155152 (-196 bytes)
fs/reiser4/init_super.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/reiser4/init_super.c +1 -2
@@ -17,14 +17,13 @@ int reiser4_init_fs_info(struct super_bl {reiser4_super_info_data *sbinfo; - sbinfo =kmalloc (sizeof (reiser4_super_info_data), + sbinfo =kzalloc (sizeof (reiser4_super_info_data),reiser4_ctx_gfp_mask_get ());if (!sbinfo)return RETERR (-ENOMEM ); super->s_fs_info = sbinfo; super->s_op =NULL ; -memset (sbinfo,0 ,sizeof (*sbinfo));ON_DEBUG (INIT_LIST_HEAD (&sbinfo->all_jnodes));ON_DEBUG (spin_lock_init (&sbinfo->all_guard));
PATCH 1/1 fs/autofs4/inode.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski fs/autofs4/inode.c | 10467 -> 10435 (-32 bytes)
fs/autofs4/inode.o | 98576 -> 98552 (-24 bytes)
fs/autofs4/inode.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/autofs4/inode.c +1 -3
@@ -312,13 +312,11 @@ int autofs4_fill_super(struct super_blocstruct autofs_sb_info *sbi;struct autofs_info *ino; - sbi =kmalloc (sizeof (*sbi),GFP_KERNEL ); + sbi =kzalloc (sizeof (*sbi),GFP_KERNEL );if (!sbi) goto fail_unlock;DPRINTK ("starting up, sbi = %p" ,sbi); -memset (sbi,0 ,sizeof (*sbi)); - s->s_fs_info = sbi; sbi->magic =AUTOFS_SBI_MAGIC ; sbi->pipefd =-1 ;
Ian Kent
maintainerRe: [PATCH 34] fs/autofs4/inode.c: kmalloc + memset conversion to kzalloc
Quoted 1 line · Mariusz Kozlowski
Signed-off-by Mariusz Kozlowski <[email protected]>
ACK.
Quoted 29 lines
fs/autofs4/inode.c| 10467 -> 10435 (-32 bytes)
fs/autofs4/inode.o| 98576 -> 98552 (-24 bytes)fs/autofs4/inode.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)fs/autofs4/inode.c +1
-4@@ -312,13 +312,11 @@ int autofs4_fill_super(struct super_blocstruct autofs_sb_info *sbi;struct autofs_info *ino; - sbi =kmalloc (sizeof (*sbi),GFP_KERNEL ); + sbi =kzalloc (sizeof (*sbi),GFP_KERNEL );if (!sbi) goto fail_unlock;DPRINTK ("starting up, sbi = %p" ,sbi); -memset (sbi,0 ,sizeof (*sbi)); - s->s_fs_info = sbi; sbi->magic =AUTOFS_SBI_MAGIC ; sbi->pipefd =-1 ; -To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
PATCH 1/1 fs/reiser4/plugin/inode_ops_rename.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski fs/reiser4/plugin/inode_ops_rename.c | 28474 -> 28344 (-130 bytes) fs/reiser4/plugin/inode_ops_rename.o | 142600 -> 142476 (-124 bytes)
fs/reiser4/plugin/inode_ops_rename.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
fs/reiser4/plugin/inode_ops_rename.c +2 -4
@@ -392,16 +392,14 @@ int reiser4_rename_common(struct inode *if (IS_ERR (ctx))return PTR_ERR (ctx); - old_entry =kmalloc (3 *sizeof (*old_entry) +2 *sizeof (*new_lh) + + old_entry =kzalloc (3 *sizeof (*old_entry) +2 *sizeof (*new_lh) +sizeof (*dotdot_name) +sizeof (*dataonstack),reiser4_ctx_gfp_mask_get ()); -if (old_entry =NULL ) { +if (!old_entry) {context_set_commit_async (ctx);reiser4_exit_context (ctx);return RETERR (-ENOMEM ); } -memset (old_entry,0 ,3 *sizeof (*old_entry) +2 *sizeof (*new_lh) + -sizeof (*dotdot_name) +sizeof (*dataonstack)); new_entry = old_entry +1 ; dotdot_entry = old_entry +2 ;
PATCH 1/1 arch/x86_64/kernel/io_apic.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski arch/x86_64/kernel/io_apic.c | 56080 -> 56038 (-42 bytes)
arch/x86_64/kernel/io_apic.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86_64/kernel/io_apic.c +2 -3
@@ -1845,7 +1845,7 @@ static struct sysdev_class ioapic_sysdevstatic int __init ioapic_init_sysfs (void ) {struct sys_device * dev; -int i, size, error =0 ; +int i, size, error; error =sysdev_class_register (&ioapic_sysdev_class);if (error)
@@ -1854,12 +1854,11 @@ static int __init ioapic_init_sysfs(voidfor (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;
PATCH 1/1 arch/i386/kernel/io_apic.c: kmalloc + memset conversion to k[cz]alloc
In reply to Mariusz Kozlowski arch/i386/kernel/io_apic.c | 70761 -> 70562 (-199 bytes) arch/i386/kernel/io_apic.o | 197654 -> 197030 (-624 bytes)
arch/i386/kernel/io_apic.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
arch/i386/kernel/io_apic.c +5 -8
@@ -690,14 +690,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 ); -if (irq_cpu_data[i].irq_delta =NULL || irq_cpu_data[i].last_irq =NULL ) { + irq_cpu_data[i].irq_delta =kcalloc (NR_IRQS ,sizeof (unsigned long ),GFP_KERNEL ); + irq_cpu_data[i].last_irq =kcalloc (NR_IRQS ,sizeof (unsigned long ),GFP_KERNEL ); +if (!irq_cpu_data[i].irq_delta || !irq_cpu_data[i].last_irq) {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" );
@@ -2398,7 +2396,7 @@ static struct sysdev_class ioapic_sysdevstatic int __init ioapic_init_sysfs (void ) {struct sys_device * dev; -int i, size, error =0 ; +int i, size, error; error =sysdev_class_register (&ioapic_sysdev_class);if (error)
@@ -2407,12 +2405,11 @@ static int __init ioapic_init_sysfs(voidfor (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;
PATCH 1/1 drivers/char/ip2/ip2main.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/char/ip2/ip2main.c | 104398 -> 104346 (-52 bytes) drivers/char/ip2/ip2main.o | 210710 -> 210702 (-8 bytes)
drivers/char/ip2/ip2main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/char/ip2/ip2main.c +2 -3
@@ -646,10 +646,9 @@ ip2_loadmain(int *iop, int *irqp, unsignfor ( i =0 ; i <IP2_MAX_BOARDS ; ++i ) {if ( ip2config.addr[i] ) { - pB =kmalloc (sizeof (i2eBordStr),GFP_KERNEL ); -if ( pB !=NULL ) { + pB =kzalloc (sizeof (i2eBordStr),GFP_KERNEL ); +if (pB) { i2BoardPtrTable[i] = pB; -memset ( pB,0 ,sizeof (i2eBordStr) );iiSetAddress ( pB, ip2config.addr[i], ii2DelayTimer );iiReset ( pB ); }else {
Re: [PATCH 38] drivers/char/ip2/ip2main.c: kmalloc + memset conversion to kzalloc
Quoted 1 line · On Tue, 31 Jul 2007 20:13:50 +0200 Mariusz Kozlowski <[email protected]>…
Signed-off-by Mariusz Kozlowski <[email protected]>
PATCH 1/1 net/ipv4/ip_options.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski net/ipv4/ip_options.c | 15425 -> 15368 (-57 bytes) net/ipv4/ip_options.o | 133668 -> 133588 (-80 bytes)
net/ipv4/ip_options.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
net/ipv4/ip_options.c +2 -5
@@ -513,11 +513,8 @@ void ip_options_undo(struct ip_options *static struct ip_options *ip_options_get_alloc (const int optlen) { -struct ip_options *opt =kmalloc (sizeof (*opt) + ((optlen +3 ) & ~3 ), -GFP_KERNEL ); -if (opt) -memset (opt,0 ,sizeof (*opt)); -return opt; +return kzalloc (sizeof (struct ip_options ) + ((optlen +3 ) & ~3 ), +GFP_KERNEL ); } static int ip_options_get_finish(struct ip_options **optp,
Re: [PATCH 39] net/ipv4/ip_options.c: kmalloc + memset conversion to kzalloc
From: Mariusz Kozlowski <[email protected]>
Date: Tue, 31 Jul 2007 20:16:59 +0200
Quoted 1 line
Signed-off-by Mariusz Kozlowski <[email protected]>
Applied, but note that this patch changes behavior, previously only the ip_options structure base was cleared out, but now the whole memory region is cleared.
I think it's OK for this case, but I'm just making note of it.
Re: [PATCH 39] net/ipv4/ip_options.c: kmalloc + memset conversion to kzalloc
Quoted 5 lines
Applied, but note that this patch changes behavior, previously only the
ip_optionsstructure base was cleared out, but now the whole memory region is cleared.I think it's OK for this case, but I'm just making note of it.
Agrh. Sorry. I must have overlook this. Feel free to drop it if you think its not worth it :-)
Thanks,
Mariusz
PATCH 1/1 drivers/atm/iphase.c: mostly kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/atm/iphase.c | 111508 -> 111431 (-77 bytes) drivers/atm/iphase.o | 254740 -> 254260 (-480 bytes)
drivers/atm/iphase.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/atm/iphase.c +6 -6
@@ -1601,14 +1601,14 @@ static int rx_init(struct atm_dev *dev)skb_queue_head_init (&iadev->rx_dma_q); iadev->rx_free_desc_qhead =NULL ; - iadev->rx_open =kmalloc (4 *iadev->num_vc,GFP_KERNEL ); -if (!iadev->rx_open) - { + + iadev->rx_open =kzalloc (4 * iadev->num_vc,GFP_KERNEL ); +if (!iadev->rx_open) { printk(KERN_ERR DEV_LABEL "itf %d couldn't get free page\n", dev->number); goto err_free_dle; } -memset (iadev->rx_open,0 ,4 *iadev->num_vc); + iadev->rxing =1 ; iadev->rx_pkt_cnt =0 ;/* Mode Register */
@@ -3171,12 +3171,12 @@ static int __devinit ia_init_one(structunsigned long flags;int ret; - iadev =kmalloc (sizeof (*iadev),GFP_KERNEL ); + iadev =kzalloc (sizeof (*iadev),GFP_KERNEL );if (!iadev) { ret = -ENOMEM ; goto err_out; } -memset (iadev,0 ,sizeof (*iadev)); + iadev->pci = pdev; IF_INIT(printk("ia detected at bus:%d dev: %d function:%d\n",
David Miller
maintainerRe: [PATCH 40] drivers/atm/iphase.c: mostly kmalloc + memset conversion to kzalloc
From: Mariusz Kozlowski <[email protected]>
Date: Tue, 31 Jul 2007 20:18:55 +0200
Quoted 1 line
Signed-off-by Mariusz Kozlowski <[email protected]>
Patch doesn't apply, perhaps there are some changes to this driver in the -mm tree.
PATCH 1/1 drivers/net/irda/irda-usb.c: mostly kmalloc + memset conversion to k[cz]alloc
In reply to Mariusz Kozlowski drivers/net/irda/irda-usb.c | 59694 -> 59541 (-153 bytes) drivers/net/irda/irda-usb.o | 170588 -> 169256 (-1332 bytes)
drivers/net/irda/irda-usb.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-)
drivers/net/irda/irda-usb.c +10 -14
@@ -1561,10 +1561,9 @@ static inline struct irda_class_desc *irstruct irda_class_desc *desc;int ret; - desc =kmalloc (sizeof (*desc),GFP_KERNEL ); -if (desc =NULL ) + desc =kzalloc (sizeof (*desc),GFP_KERNEL ); +if (!desc)return NULL ; -memset (desc,0 ,sizeof (*desc));/* USB-IrDA class spec 1.0: * 6.1.3: Standard "Get Descriptor" Device Request is not
@@ -1617,7 +1616,7 @@ static int irda_usb_probe(struct usb_int {struct net_device *net;struct usb_device *dev =interface_to_usbdev (intf); -struct irda_usb_cb *self =NULL ; +struct irda_usb_cb *self;struct usb_host_interface *interface;struct irda_class_desc *irda_desc;int ret = -ENOMEM ;
@@ -1655,7 +1654,7 @@ static int irda_usb_probe(struct usb_int self->header_length =USB_IRDA_HEADER ; } - self->rx_urb =kzalloc (self->max_rx_urb *sizeof (struct urb *), + self->rx_urb =kcalloc (self->max_rx_urb,sizeof (struct urb *),GFP_KERNEL );for (i =0 ; i < self->max_rx_urb; i++) {
@@ -1715,7 +1714,7 @@ static int irda_usb_probe(struct usb_int/* Find IrDA class descriptor */ irda_desc =irda_usb_find_class_desc (intf); ret = -ENODEV ; -if (irda_desc =NULL ) +if (!irda_desc) goto err_out_3;if (self->needspatch) {
@@ -1738,15 +1737,13 @@ static int irda_usb_probe(struct usb_int/* Don't change this buffer size and allocation without doing * some heavy and complete testing. Don't ask why :-( * Jean II */ - self->speed_buff =kmalloc (IRDA_USB_SPEED_MTU ,GFP_KERNEL ); -if (self->speed_buff =NULL ) + self->speed_buff =kzalloc (IRDA_USB_SPEED_MTU ,GFP_KERNEL ); +if (!self->speed_buff) goto err_out_3; -memset (self->speed_buff,0 ,IRDA_USB_SPEED_MTU ); - self->tx_buff =kzalloc (IRDA_SKB_MAX_MTU + self->header_length,GFP_KERNEL ); -if (self->tx_buff =NULL ) +if (!self->tx_buff) goto err_out_4; ret =irda_usb_open (self);
@@ -1767,12 +1764,11 @@ static int irda_usb_probe(struct usb_int/* replace IrDA class descriptor with what patched device is now reporting */ irda_desc =irda_usb_find_class_desc (self->usbintf); -if (irda_desc =NULL ) { +if (!irda_desc) { ret = -ENODEV ; goto err_out_6; } -if (self->irda_desc) -kfree (self->irda_desc); +kfree (self->irda_desc); self->irda_desc = irda_desc;irda_usb_init_qos (self); }
David Miller
maintainerRe: [PATCH 41] drivers/net/irda/irda-usb.c: mostly kmalloc + memset conversion to k[cz]alloc
From: Mariusz Kozlowski <[email protected]>
Date: Tue, 31 Jul 2007 20:20:37 +0200
Quoted 1 line
Signed-off-by Mariusz Kozlowski <[email protected]>
Like the ATM patch, this one doesn't apply cleanly.
Re: [PATCH 41] drivers/net/irda/irda-usb.c: mostly kmalloc + memset conversion to k[cz]alloc
Quoted 3 lines
Quoted 1 line
Signed-off-by Mariusz Kozlowski <[email protected]>Like the ATM patch, this one doesn't apply cleanly.
Ok I'll give another k[czm]alloc run right after -mm2 shows up.
Thanks,
Mariusz
PATCH 1/1 fs/jbd2/journal.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski fs/jbd2/journal.c | 66771 -> 66719 (-52 bytes) fs/jbd2/journal.o | 199193 -> 199049 (-144 bytes)
fs/jbd2/journal.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/jbd2/journal.c +3 -4
@@ -929,17 +929,16 @@ static void journal_init_stats(journal_t {int size; -if (proc_jbd2_stats =NULL ) +if (!proc_jbd2_stats)return ; journal->j_history_max =100 ; size =sizeof (struct transaction_stats_s ) * journal->j_history_max; - journal->j_history =kmalloc (size,GFP_KERNEL ); -if (journal->j_history =NULL ) { + journal->j_history =kzalloc (size,GFP_KERNEL ); +if (!journal->j_history) { journal->j_history_max =0 ;return ; } -memset (journal->j_history,0 , size);spin_lock_init (&journal->j_history_lock); }
PATCH 1/1 fs/reiser4/ktxnmgrd.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski fs/reiser4/ktxnmgrd.c | 5314 -> 5277 (-37 bytes) fs/reiser4/ktxnmgrd.o | 131624 -> 131496 (-128 bytes)
fs/reiser4/ktxnmgrd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
fs/reiser4/ktxnmgrd.c +2 -3
@@ -130,13 +130,12 @@ int reiser4_init_ktxnmgrd(struct super_bassert ("zam-1014" , mgr->daemon =NULL ); - ctx =kmalloc (sizeof (ktxnmgrd_context),reiser4_ctx_gfp_mask_get ()); -if (ctx =NULL ) + ctx =kzalloc (sizeof (ktxnmgrd_context),reiser4_ctx_gfp_mask_get ()); +if (!ctx)return RETERR (-ENOMEM );assert ("nikita-2442" , ctx !=NULL ); -memset (ctx,0 ,sizeof *ctx);init_waitqueue_head (&ctx->wait);/*kcond_init(&ctx->startup);*/
PATCH 1/1 drivers/scsi/lpfc/lpfc_debugfs.c: kmalloc + memset conversion to kcalloc
In reply to Mariusz Kozlowski drivers/scsi/lpfc/lpfc_debugfs.c | 13809 -> 13716 (-93 bytes) drivers/scsi/lpfc/lpfc_debugfs.o | 146124 -> 146124 (0 bytes)
drivers/scsi/lpfc/lpfc_debugfs.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/scsi/lpfc/lpfc_debugfs.c +2 -5
@@ -432,14 +432,11 @@ lpfc_debugfs_initialize(struct lpfc_vporif (!lpfc_debugfs_start_time) lpfc_debugfs_start_time = jiffies; - vport->disc_trc =kmalloc ( - (sizeof (struct lpfc_disc_trc ) * lpfc_debugfs_max_disc_trc), -GFP_KERNEL ); + vport->disc_trc =kcalloc (lpfc_debugfs_max_disc_trc, +sizeof (struct lpfc_disc_trc ),GFP_KERNEL );if (!vport->disc_trc) goto debug_failed; -memset (vport->disc_trc,0 , - (sizeof (struct lpfc_disc_trc ) * lpfc_debugfs_max_disc_trc));snprintf (name,sizeof (name),"discovery_trace" ); vport->debug_disc_trc
Re: [PATCH 44] drivers/scsi/lpfc/lpfc_debugfs.c: kmalloc + memset conversion to kcalloc
ACK
-- james s
Quoted 27 lines · Mariusz Kozlowski
Signed-off-by Mariusz Kozlowski <[email protected]>
drivers/scsi/lpfc/lpfc_debugfs.c| 13809 -> 13716 (-93 bytes)drivers/scsi/lpfc/lpfc_debugfs.o| 146124 -> 146124 (0 bytes)drivers/scsi/lpfc/lpfc_debugfs.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)drivers/scsi/lpfc/lpfc_debugfs.c +2
-5@@ -432,14 +432,11 @@ lpfc_debugfs_initialize(struct lpfc_vporif (!lpfc_debugfs_start_time) lpfc_debugfs_start_time = jiffies; - vport->disc_trc =kmalloc ( - (sizeof (struct lpfc_disc_trc ) * lpfc_debugfs_max_disc_trc), -GFP_KERNEL ); + vport->disc_trc =kcalloc (lpfc_debugfs_max_disc_trc, +sizeof (struct lpfc_disc_trc ),GFP_KERNEL );if (!vport->disc_trc) goto debug_failed; -memset (vport->disc_trc,0 , - (sizeof (struct lpfc_disc_trc ) * lpfc_debugfs_max_disc_trc));snprintf (name,sizeof (name),"discovery_trace" ); vport->debug_disc_trc >
PATCH 1/1 drivers/scsi/lpfc/lpfc_init.c: kmalloc + memset conversion to kcalloc
In reply to Mariusz Kozlowski drivers/scsi/lpfc/lpfc_init.c | 65932 -> 65881 (-51 bytes) drivers/scsi/lpfc/lpfc_init.o | 219760 -> 219616 (-144 bytes)
drivers/scsi/lpfc/lpfc_init.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +1 -2
@@ -1280,11 +1280,10 @@ lpfc_hba_init(struct lpfc_hba *phba, uinuint32_t *HashWorking;uint32_t *pwwnn = (uint32_t *) phba->wwnn; - HashWorking =kmalloc (80 *sizeof (uint32_t ),GFP_KERNEL ); + HashWorking =kcalloc (80 ,sizeof (uint32_t ),GFP_KERNEL );if (!HashWorking)return ; -memset (HashWorking,0 , (80 *sizeof (uint32_t ))); HashWorking[0 ] = HashWorking[78 ] = *pwwnn++; HashWorking[1 ] = HashWorking[79 ] = *pwwnn;
Re: [PATCH 45] drivers/scsi/lpfc/lpfc_init.c: kmalloc + memset conversion to kcalloc
ACK
-- james s
Quoted 24 lines · Mariusz Kozlowski
Signed-off-by Mariusz Kozlowski <[email protected]>
drivers/scsi/lpfc/lpfc_init.c| 65932 -> 65881 (-51 bytes)drivers/scsi/lpfc/lpfc_init.o| 219760 -> 219616 (-144 bytes)drivers/scsi/lpfc/lpfc_init.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/scsi/lpfc/lpfc_init.c +1
-2@@ -1280,11 +1280,10 @@ lpfc_hba_init(struct lpfc_hba *phba, uinuint32_t *HashWorking;uint32_t *pwwnn = (uint32_t *) phba->wwnn; - HashWorking =kmalloc (80 *sizeof (uint32_t ),GFP_KERNEL ); + HashWorking =kcalloc (80 ,sizeof (uint32_t ),GFP_KERNEL );if (!HashWorking)return ; -memset (HashWorking,0 , (80 *sizeof (uint32_t ))); HashWorking[0 ] = HashWorking[78 ] = *pwwnn++; HashWorking[1 ] = HashWorking[79 ] = *pwwnn;
PATCH 1/1 drivers/scsi/lpfc/lpfc_scsi.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/scsi/lpfc/lpfc_scsi.c | 42769 -> 42721 (-48 bytes) drivers/scsi/lpfc/lpfc_scsi.o | 191332 -> 191240 (-92 bytes)
drivers/scsi/lpfc/lpfc_scsi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_scsi.c +1 -2
@@ -208,10 +208,9 @@ lpfc_new_scsi_buf(struct lpfc_vport *vpodma_addr_t pdma_phys;uint16_t iotag; - psb =kmalloc (sizeof (struct lpfc_scsi_buf ),GFP_KERNEL ); + psb =kzalloc (sizeof (struct lpfc_scsi_buf ),GFP_KERNEL );if (!psb)return NULL ; -memset (psb,0 ,sizeof (struct lpfc_scsi_buf ));/* * Get memory from the pci pool to map the virt space to pci bus space
Re: [PATCH 46] drivers/scsi/lpfc/lpfc_scsi.c: kmalloc + memset conversion to kzalloc
ACK
-- james s
Quoted 23 lines · Mariusz Kozlowski
Signed-off-by Mariusz Kozlowski <[email protected]>
drivers/scsi/lpfc/lpfc_scsi.c| 42769 -> 42721 (-48 bytes)drivers/scsi/lpfc/lpfc_scsi.o| 191332 -> 191240 (-92 bytes)drivers/scsi/lpfc/lpfc_scsi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/scsi/lpfc/lpfc_scsi.c +1
-2@@ -208,10 +208,9 @@ lpfc_new_scsi_buf(struct lpfc_vport *vpodma_addr_t pdma_phys;uint16_t iotag; - psb =kmalloc (sizeof (struct lpfc_scsi_buf ),GFP_KERNEL ); + psb =kzalloc (sizeof (struct lpfc_scsi_buf ),GFP_KERNEL );if (!psb)return NULL ; -memset (psb,0 ,sizeof (struct lpfc_scsi_buf ));/* * Get memory from the pci pool to map the virt space to pci bus space
PATCH 1/1 lpfc : lpfc_debugfs.c kmalloc + memset conversion to kzalloc
One more area, introduced by the lpfc 8.2.2 patches, that need the
kmalloc+memset conversion.
This patch to be applied atop the 8.2.2 patches.
-- james s
drivers/scsi/lpfc/lpfc_debugfs.c +3 -6
@@ -856,9 +856,9 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) goto debug_failed; }if (!phba->slow_ring_trc) { - phba->slow_ring_trc =kmalloc ( - (sizeof (struct lpfc_debugfs_trc ) * - lpfc_debugfs_max_slow_ring_trc), + phba->slow_ring_trc =kcalloc ( + lpfc_debugfs_max_slow_ring_trc, +sizeof (struct lpfc_debugfs_trc ),GFP_KERNEL );if (!phba->slow_ring_trc) { lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
@@ -867,9 +867,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) goto debug_failed; }atomic_set (&phba->slow_ring_trc_cnt,0 ); -memset (phba->slow_ring_trc,0 , - (sizeof (struct lpfc_debugfs_trc ) * - lpfc_debugfs_max_slow_ring_trc)); } }
PATCH 1/1 lpfc : lpfc_debugfs.c kmalloc + memset conversion to kzalloc
In reply to James SmartOne more area, introduced by the lpfc 8.2.2 patches, that need the
kmalloc+memset conversion.
This patch to be applied atop the 8.2.2 patches.
-- james s
drivers/scsi/lpfc/lpfc_debugfs.c +3 -6
@@ -856,9 +856,9 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) goto debug_failed; }if (!phba->slow_ring_trc) { - phba->slow_ring_trc =kmalloc ( - (sizeof (struct lpfc_debugfs_trc ) * - lpfc_debugfs_max_slow_ring_trc), + phba->slow_ring_trc =kcalloc ( + lpfc_debugfs_max_slow_ring_trc, +sizeof (struct lpfc_debugfs_trc ),GFP_KERNEL );if (!phba->slow_ring_trc) { lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
@@ -867,9 +867,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) goto debug_failed; }atomic_set (&phba->slow_ring_trc_cnt,0 ); -memset (phba->slow_ring_trc,0 , - (sizeof (struct lpfc_debugfs_trc ) * - lpfc_debugfs_max_slow_ring_trc)); } }
PATCH 1/1 lpfc : lpfc_debugfs.c kmalloc + memset conversion to kzalloc
In reply to James SmartOne more area, introduced by the lpfc 8.2.2 patches, that need the
kmalloc+memset conversion.
This patch to be applied atop the 8.2.2 patches.
-- james s
drivers/scsi/lpfc/lpfc_debugfs.c +3 -6
@@ -856,9 +856,9 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) goto debug_failed; }if (!phba->slow_ring_trc) { - phba->slow_ring_trc =kmalloc ( - (sizeof (struct lpfc_debugfs_trc ) * - lpfc_debugfs_max_slow_ring_trc), + phba->slow_ring_trc =kcalloc ( + lpfc_debugfs_max_slow_ring_trc, +sizeof (struct lpfc_debugfs_trc ),GFP_KERNEL );if (!phba->slow_ring_trc) { lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
@@ -867,9 +867,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) goto debug_failed; }atomic_set (&phba->slow_ring_trc_cnt,0 ); -memset (phba->slow_ring_trc,0 , - (sizeof (struct lpfc_debugfs_trc ) * - lpfc_debugfs_max_slow_ring_trc)); } }
PATCH 1/1 drivers/scsi/megaraid.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz KozlowskiThis patch does kmalloc + memset conversion to kzalloc and adds missing check for kzaloc return value.
drivers/scsi/megaraid.c | 116109 -> 116094 (-15 bytes) drivers/scsi/megaraid.o | 257872 -> 257772 (-100 bytes)
drivers/scsi/megaraid.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/megaraid.c +4 -2
@@ -4408,8 +4408,10 @@ mega_internal_command(adapter_t *adapter scmd = &adapter->int_scmd;memset (scmd,0 ,sizeof (Scsi_Cmnd)); - sdev =kmalloc (sizeof (struct scsi_device ),GFP_KERNEL ); -memset (sdev,0 ,sizeof (struct scsi_device )); + sdev =kzalloc (sizeof (struct scsi_device ),GFP_KERNEL ); +if (!sdev) +return -ENOMEM ; + scmd->device = sdev; scmd->device->host = adapter->host;
PATCH 1/1 include/asm-mips/thread_info.h: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowskiinclude/asm-mips/thread_info.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
include/asm-mips/thread_info.h +2 -3
@@ -87,9 +87,8 @@ register struct thread_info *__current_t ({ \struct thread_info *ret; \ \ - ret =kmalloc (THREAD_SIZE ,GFP_KERNEL ); \ -if (ret) \ -memset (ret,0 ,THREAD_SIZE ); \ + ret =kzalloc (THREAD_SIZE ,GFP_KERNEL ); \ + \ ret; \ }) #else
Ralf Baechle
AppliedRe: [PATCH 48] include/asm-mips/thread_info.h: kmalloc + memset conversion to kzalloc
On Tue, Jul 31, 2007 at 08:48:41PM +0200, Mariusz Kozlowski wrote:
Thanks, applied.
PATCH 1/1 drivers/mmc/core/mmc_ops.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/mmc/core/mmc_ops.c | 7957 -> 7924 (-33 bytes) drivers/mmc/core/mmc_ops.o | 101732 -> 101744 (+12 bytes)
drivers/mmc/core/mmc_ops.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mmc/core/mmc_ops.c +1 -2
@@ -298,10 +298,9 @@ int mmc_lock_unlock(struct mmc_card *car data_size =2 + mpayload->datalen; } - data_buf =kmalloc (data_size,GFP_KERNEL ); + data_buf =kzalloc (data_size,GFP_KERNEL );if (!data_buf)return -ENOMEM ; -memset (data_buf,0 , data_size); data_buf[0 ] |= mode;if (mode &MMC_LOCK_MODE_UNLOCK )
Re: [PATCH 49] drivers/mmc/core/mmc_ops.c: kmalloc + memset conversion to kzalloc
Quoted 8 lines · On Tue, 31 Jul 2007 20:50:13 +0200 Mariusz Kozlowski <[email protected]>…
Signed-off-by Mariusz Kozlowski <[email protected]>
drivers/mmc/core/mmc_ops.c| 7957 -> 7924 (-33 bytes)drivers/mmc/core/mmc_ops.o| 101732 -> 101744 (+12 bytes)drivers/mmc/core/mmc_ops.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Signature · 5 lines
-- Pierre Ossman Linux kernel, MMC maintainer http://www.kernel.org PulseAudio, core developer http://pulseaudio.org rdesktop, core developer http://www.rdesktop.org
PATCH 1/1 drivers/message/fusion/mptctl.c: mostly kmalloc + memset conversion to kzalloc
In reply to Mariusz KozlowskiThis patch does kmalloc + memset conversion to kzalloc and simplifies mptctl_probe().
drivers/message/fusion/mptctl.c | 82092 -> 81884 (-208 bytes) drivers/message/fusion/mptctl.o | 201784 -> 200648 (-1136 bytes)
drivers/message/fusion/mptctl.c | 36 ++++++++++-------------------- 1 file changed, 12 insertions(+), 24 deletions(-)
drivers/message/fusion/mptctl.c +12 -24
@@ -963,10 +963,9 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, i* structures for the SG elements. */ i =MAX_SGL_BYTES /8 ; - buflist =kmalloc (i,GFP_USER ); -if (buflist =NULL ) + buflist =kzalloc (i,GFP_USER ); +if (!buflist)return NULL ; -memset (buflist,0 , i); buflist_ent =0 ;/* Allocate a single block of memory to store the sg elements and
@@ -1363,13 +1362,12 @@ mptctl_gettargetinfo (unsigned long arg)* 15- 8: Bus Number * 7- 0: Target ID */ - pmem =kmalloc (numBytes,GFP_KERNEL ); -if (pmem =NULL ) { + pmem =kzalloc (numBytes,GFP_KERNEL ); +if (!pmem) {printk (KERN_ERR "%s::mptctl_gettargetinfo() @%d - no memory available!\n" , __FILE__, __LINE__);return -ENOMEM ; } -memset (pmem,0 , numBytes); pdata = (int *) pmem;/* Get number of devices
@@ -1551,12 +1549,11 @@ mptctl_eventenable (unsigned long arg)/* Have not yet allocated memory - do so now. */ int sz =MPTCTL_EVENT_LOG_SIZE *sizeof (MPT_IOCTL_EVENTS ); - ioc->events =kmalloc (sz,GFP_KERNEL ); -if (ioc->events =NULL ) { + ioc->events =kzalloc (sz,GFP_KERNEL ); +if (!ioc->events) { printk(KERN_ERR MYNAM ": ERROR - Insufficient memory to add adapter!\n");return -ENOMEM ; } -memset (ioc->events,0 , sz); ioc->alloc_total += sz; ioc->eventContext =0 ;
@@ -2823,31 +2820,22 @@ static long compat_mpctl_ioctl(struct fistatic int mptctl_probe (struct pci_dev *pdev,const struct pci_device_id *id) { -int err; -int sz; -u8 *mem; +MPT_IOCTL *mem;MPT_ADAPTER *ioc =pci_get_drvdata (pdev);/* * Allocate and inite a MPT_IOCTL structure */ - sz =sizeof (MPT_IOCTL ); - mem =kmalloc (sz,GFP_KERNEL ); -if (mem =NULL ) { - err = -ENOMEM ; - goto out_fail; + mem =kzalloc (sizeof (MPT_IOCTL ),GFP_KERNEL ); +if (!mem) { +mptctl_remove (pdev); +return -ENOMEM ; } -memset (mem,0 , sz); - ioc->ioctl = (MPT_IOCTL *) mem; + ioc->ioctl = mem; ioc->ioctl->ioc = ioc;mutex_init (&ioc->ioctl->ioctl_mutex);return 0 ; - -out_fail: - -mptctl_remove (pdev); -return err; }/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
PATCH 1/1 drivers/media/video/msp3400-driver.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/media/video/msp3400-driver.c | 28945 -> 28898 (-47 bytes) drivers/media/video/msp3400-driver.o | 125620 -> 125320 (-300 bytes)
drivers/media/video/msp3400-driver.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/media/video/msp3400-driver.c +5 -4
@@ -813,8 +813,9 @@ static int msp_attach(struct i2c_adapterint msp_rom; client =kzalloc (sizeof (*client),GFP_KERNEL ); -if (client =NULL ) +if (!client)return -ENOMEM ; + client->addr = address; client->adapter = adapter; client->driver = &i2c_driver;
@@ -826,14 +827,14 @@ static int msp_attach(struct i2c_adapterreturn 0 ; } - state =kmalloc (sizeof (*state),GFP_KERNEL ); -if (state =NULL ) { + state =kzalloc (sizeof (*state),GFP_KERNEL ); +if (!state) {kfree (client);return -ENOMEM ; } +i2c_set_clientdata (client, state); -memset (state,0 ,sizeof (*state)); state->v4l2_std =V4L2_STD_NTSC ; state->audmode =V4L2_TUNER_MODE_STEREO ; state->volume =58880 ;/* 0db gain */
PATCH 1/1 include/asm-m32r/thread_info.h: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowskiinclude/asm-m32r/thread_info.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
include/asm-m32r/thread_info.h +2 -3
@@ -100,9 +100,8 @@ static inline struct thread_info *curren ({ \struct thread_info *ret; \ \ - ret =kmalloc (THREAD_SIZE ,GFP_KERNEL ); \ -if (ret) \ -memset (ret,0 ,THREAD_SIZE ); \ + ret =kzalloc (THREAD_SIZE ,GFP_KERNEL ); \ + \ ret; \ }) #else
Re: [PATCH 52] include/asm-m32r/thread_info.h: kmalloc + memset conversion to kzalloc
From: Mariusz Kozlowski <[email protected]>
Date: Tue, 31 Jul 2007 21:18:33 +0200
Quoted 5 lines
Signed-off-by Mariusz Kozlowski <[email protected]>include/asm-m32r/thread_info.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Thank you.
PATCH 1/1 Documentation/DocBook/mtdnand.tmpl: kmalloc + memset conversion to kzalloc
In reply to Mariusz KozlowskiDocumentation/DocBook/mtdnand.tmpl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
Documentation/DocBook/mtdnand.tmpl +1 -4
@@ -275,16 +275,13 @@ int __init board_init (void) int err = 0; /* Allocate memory for MTD device structure and private data */ - board_mtd = kmalloc (sizeof(struct mtd_info) + sizeof (struct nand_chip), GFP_KERNEL); + board_mtd = kzalloc(sizeof(struct mtd_info) + sizeof(struct nand_chip), GFP_KERNEL); if (!board_mtd) { printk ("Unable to allocate NAND MTD device structure.\n"); err = -ENOMEM; goto out; } - /* Initialize structures */ - memset ((char *) board_mtd, 0, sizeof(struct mtd_info) + sizeof(struct nand_chip)); - /* map physical adress */ baseaddr = (unsigned long)ioremap(CHIP_PHYSICAL_ADDRESS, 1024); if(!baseaddr){
PATCH 1/1 drivers/scsi/mvme16x_scsi.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/scsi/mvme16x_scsi.c | 3740 -> 3678 (-62 bytes)
drivers/scsi/mvme16x_scsi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/mvme16x_scsi.c +1 -2
@@ -48,13 +48,12 @@ mvme16x_probe(struct device *dev) goto out; } - hostdata =kmalloc (sizeof (struct NCR_700_Host_Parameters ),GFP_KERNEL ); + hostdata =kzalloc (sizeof (struct NCR_700_Host_Parameters ),GFP_KERNEL );if (hostdata =NULL ) {printk (KERN_ERR "mvme16x-scsi: " "Failed to allocate host data\n" ); goto out; } -memset (hostdata,0 ,sizeof (struct NCR_700_Host_Parameters ));/* Fill in the required pieces of hostdata */ hostdata->base = (void __iomem *)0xfff47000UL ;
PATCH 1/1 drivers/char/n_hdlc.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/char/n_hdlc.c | 27451 -> 27423 (-28 bytes) drivers/char/n_hdlc.o | 112528 -> 112516 (-12 bytes)
drivers/char/n_hdlc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/char/n_hdlc.c +3 -4
@@ -807,13 +807,12 @@ static struct n_hdlc *n_hdlc_alloc(void) {struct n_hdlc_buf *buf;int i; -struct n_hdlc *n_hdlc =kmalloc (sizeof (*n_hdlc),GFP_KERNEL ); - +struct n_hdlc *n_hdlc; + + n_hdlc =kzalloc (sizeof (*n_hdlc),GFP_KERNEL );if (!n_hdlc)return NULL ; -memset (n_hdlc,0 ,sizeof (*n_hdlc)); -n_hdlc_buf_list_init (&n_hdlc->rx_free_buf_list);n_hdlc_buf_list_init (&n_hdlc->tx_free_buf_list);n_hdlc_buf_list_init (&n_hdlc->rx_buf_list);
Alan Cox
NAKRe: [PATCH 55] drivers/char/n_hdlc.c: kmalloc + memset conversion to kzalloc
Quoted 1 line · On Tue, 31 Jul 2007 23:27:30 +0200 Mariusz Kozlowski <[email protected]>…
Signed-off-by Mariusz Kozlowski <[email protected]>
NAK
drivers/char/n_hdlc.c static struct n_hdlc *n_hdlc_alloc(void) · line 812
Quoted 5 lines
drivers/char/n_hdlc.c +3
-2-struct n_hdlc *n_hdlc =kmalloc (sizeof (*n_hdlc),GFP_KERNEL ); - +struct n_hdlc *n_hdlc; + + n_hdlc =kzalloc (sizeof (*n_hdlc),GFP_KERNEL );
Change looks fine but please keep the original formatting style
Re: [PATCH 55] drivers/char/n_hdlc.c: kmalloc + memset conversion to kzalloc
Quoted 11 lines
Quoted 1 line
Signed-off-by Mariusz Kozlowski <[email protected]>NAK
Review
Quoted 5 lines
(quoted diff) +3
-2- struct n_hdlc *n_hdlc = kmalloc(sizeof(*n_hdlc), GFP_KERNEL); - + struct n_hdlc *n_hdlc; + + n_hdlc = kzalloc(sizeof(*n_hdlc), GFP_KERNEL);Change looks fine but please keep the original formatting style
Ok. Here it goes (based on 2.6.23-rc1-mm2).
drivers/char/n_hdlc.c | 27451 -> 27413 (-38 bytes) drivers/char/n_hdlc.o | 107068 -> 107088 (+20 bytes)
drivers/char/n_hdlc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/char/n_hdlc.c +1 -3
@@ -807,13 +807,11 @@ static struct n_hdlc *n_hdlc_alloc(void) {struct n_hdlc_buf *buf;int i; -struct n_hdlc *n_hdlc =kmalloc (sizeof (*n_hdlc),GFP_KERNEL ); +struct n_hdlc *n_hdlc =kzalloc (sizeof (*n_hdlc),GFP_KERNEL );if (!n_hdlc)return NULL ; -memset (n_hdlc,0 ,sizeof (*n_hdlc)); -n_hdlc_buf_list_init (&n_hdlc->rx_free_buf_list);n_hdlc_buf_list_init (&n_hdlc->tx_free_buf_list);n_hdlc_buf_list_init (&n_hdlc->rx_buf_list);
Krzysztof Halasa
maintainerRe: [PATCH 55] drivers/char/n_hdlc.c: kmalloc + memset conversion to kzalloc
Quoted 4 lines · Mariusz Kozlowski
Signed-off-by Mariusz Kozlowski <[email protected]>
drivers/char/n_hdlc.c| 27451 -> 27413 (-38 bytes)drivers/char/n_hdlc.o| 107068 -> 107088 (+20 bytes)
BTW: drivers/char/n_hdlc is a very different thing than these in drivers/net/wan/ and I have no connection with it. Not sure who is responsible, if anyone.
Signature · 1 line
Krzysztof Halasa
Re: [PATCH 55] drivers/char/n_hdlc.c: kmalloc + memset conversion to kzalloc
Quoted 10 lines · Krzysztof Halasa
Quoted 4 lines · Mariusz Kozlowski
Signed-off-by Mariusz Kozlowski <[email protected]>
drivers/char/n_hdlc.c| 27451 -> 27413 (-38 bytes)drivers/char/n_hdlc.o| 107068 -> 107088 (+20 bytes)BTW:
drivers/char/n_hdlcis a very different thing than these indrivers/net/wan/and I have no connection with it. Not sure who is responsible, if anyone.
I am, my email is at the top of n_hdlc.c but there is no maintainers entry.
--
Paul Fulghum
Microgate Systems, Ltd
PATCH 1/1 drivers/scsi/NCR_D700.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/scsi/NCR_D700.c | 10643 -> 10615 (-28 bytes) drivers/scsi/NCR_D700.o | 118400 -> 118196 (-204 bytes)
drivers/scsi/NCR_D700.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/NCR_D700.c +2 -2
@@ -313,10 +313,10 @@ NCR_D700_probe(struct device *dev)break ; } - p =kmalloc (sizeof (*p),GFP_KERNEL ); + p =kzalloc (sizeof (*p),GFP_KERNEL );if (!p)return -ENOMEM ; -memset (p,'\0' ,sizeof (*p)); + p->dev = dev;snprintf (p->name,sizeof (p->name),"D700(%s)" , dev->bus_id);if (request_irq (irq, NCR_D700_intr,IRQF_SHARED , p->name, p)) {
PATCH 1/1 net/netfilter/nf_conntrack_expect.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski net/netfilter/nf_conntrack_expect.c | 14786 -> 14726 (-60 bytes) net/netfilter/nf_conntrack_expect.o | 137990 -> 138154 (+164 bytes)
net/netfilter/nf_conntrack_expect.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
net/netfilter/nf_conntrack_expect.c +2 -3
@@ -477,15 +477,14 @@ static int exp_open(struct inode *inode,struct ct_expect_iter_state *st;int ret; - st =kmalloc (sizeof (struct ct_expect_iter_state ),GFP_KERNEL ); -if (st =NULL ) + st =kzalloc (sizeof (struct ct_expect_iter_state ),GFP_KERNEL ); +if (!st)return -ENOMEM ; ret =seq_open (file, &exp_seq_ops);if (ret) goto out_free; seq = file->private_data; seq->private = st; -memset (st,0 ,sizeof (struct ct_expect_iter_state ));return ret; out_free:kfree (st);
Re: [PATCH 57] net/netfilter/nf_conntrack_expect.c: kmalloc + memset conversion to kzalloc
From: Mariusz Kozlowski <[email protected]>
Date: Tue, 31 Jul 2007 23:31:02 +0200
Quoted 1 line
Signed-off-by Mariusz Kozlowski <[email protected]>
Applied.
PATCH 1/1 net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c | 10333 -> 10273 (-60 bytes) net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.o | 116092 -> 115996 (-96 bytes)
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +2 -3
@@ -294,15 +294,14 @@ static int exp_open(struct inode *inode,struct ct_expect_iter_state *st;int ret; - st =kmalloc (sizeof (struct ct_expect_iter_state ),GFP_KERNEL ); -if (st =NULL ) + st =kzalloc (sizeof (struct ct_expect_iter_state ),GFP_KERNEL ); +if (!st)return -ENOMEM ; ret =seq_open (file, &exp_seq_ops);if (ret) goto out_free; seq = file->private_data; seq->private = st; -memset (st,0 ,sizeof (struct ct_expect_iter_state ));return ret; out_free:kfree (st);
Re: [PATCH 58] net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c: kmalloc + memset conversion to kzalloc
From: Mariusz Kozlowski <[email protected]>
Date: Tue, 31 Jul 2007 23:32:04 +0200
Quoted 1 line
Signed-off-by Mariusz Kozlowski <[email protected]>
Applied.
PATCH 1/1 drivers/video/offb.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/video/offb.c | 14535 -> 14505 (-30 bytes)
drivers/video/offb.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/video/offb.c +2 -4
@@ -273,13 +273,11 @@ static void __init offb_init_fb(const ch size =sizeof (struct fb_info ) +sizeof (u32) *16 ; - info =kmalloc (size,GFP_ATOMIC ); - -if (info =0 ) { + info =kzalloc (size,GFP_ATOMIC ); +if (!info) {release_mem_region (res_start, res_size);return ; } -memset (info,0 , size); fix = &info->fix; var = &info->var;
PATCH 1/1 drivers/net/wireless/prism54/oid_mgt.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/net/wireless/prism54/oid_mgt.c | 25377 -> 25297 (-80 bytes) drivers/net/wireless/prism54/oid_mgt.o | 128460 -> 128284 (-176 bytes)
drivers/net/wireless/prism54/oid_mgt.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/wireless/prism54/oid_mgt.c +1 -3
@@ -244,13 +244,11 @@ mgt_init(islpci_private *priv)/* Alloc the cache */ for (i =0 ; i <OID_NUM_LAST ; i++) {if (isl_oid[i].flags &OID_FLAG_CACHED ) { - priv->mib[i] =kmalloc (isl_oid[i].size * + priv->mib[i] =kzalloc (isl_oid[i].size * (isl_oid[i].range +1 ),GFP_KERNEL );if (!priv->mib[i])return -ENOMEM ; -memset (priv->mib[i],0 , - isl_oid[i].size * (isl_oid[i].range +1 )); }else priv->mib[i] =NULL ; }
Re: [PATCH 60] drivers/net/wireless/prism54/oid_mgt.c: kmalloc + memset conversion to kzalloc
Quoted 1 line · Mariusz Kozlowski
Signed-off-by Mariusz Kozlowski <[email protected]>
Quoted 24 lines
drivers/net/wireless/prism54/oid_mgt.c| 25377 -> 25297 (-80 bytes)drivers/net/wireless/prism54/oid_mgt.o| 128460 -> 128284 (-176 bytes)drivers/net/wireless/prism54/oid_mgt.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/net/wireless/prism54/oid_mgt.c 2007-07-30 00:27:44.000000000 +0200 renamed from drivers/net/wireless/prism54/oid_mgt.c 2007-07-26 13:07:43.000000000 +0200 +1
-3@@ -244,13 +244,11 @@ mgt_init(islpci_private *priv) /* Alloc the cache */ for (i = 0; i < OID_NUM_LAST; i++) { if (isl_oid[i].flags & OID_FLAG_CACHED) { - priv->mib[i] = kmalloc(isl_oid[i].size * + priv->mib[i] = kzalloc(isl_oid[i].size * (isl_oid[i].range + 1), GFP_KERNEL); if (!priv->mib[i]) return -ENOMEM; - memset(priv->mib[i], 0, - isl_oid[i].size * (isl_oid[i].range + 1)); } else priv->mib[i] = NULL; }
PATCH 1/1 drivers/scsi/osst.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/scsi/osst.c | 185412 -> 185361 (-51 bytes) drivers/scsi/osst.o | 272432 -> 272344 (-88 bytes)
drivers/scsi/osst.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/osst.c +2 -3
@@ -5778,13 +5778,12 @@ static int osst_probe(struct device *dev dev_num = i;/* allocate a struct osst_tape for this device */ - tpnt =kmalloc (sizeof (struct osst_tape ),GFP_ATOMIC ); -if (tpnt =NULL ) { + tpnt =kzalloc (sizeof (struct osst_tape ),GFP_ATOMIC ); +if (!tpnt) {write_unlock (&os_scsi_tapes_lock);printk (KERN_ERR "osst :E: Can't allocate device descriptor, device not attached.\n" ); goto out_put_disk; } -memset (tpnt,0 ,sizeof (struct osst_tape ));/* allocate a buffer for this device */ i = SDp->host->sg_tablesize;
PATCH 1/1 include/asm-avr32/pgalloc.h: kmalloc + memset conversion to kcalloc
In reply to Mariusz Kozlowskiinclude/asm-avr32/pgalloc.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
include/asm-avr32/pgalloc.h +1 -7
@@ -27,13 +27,7 @@ static __inline__ void pmd_populate(stru*/ static __inline__pgd_t *pgd_alloc (struct mm_struct *mm) { -unsigned int pgd_size = (USER_PTRS_PER_PGD *sizeof (pgd_t)); -pgd_t *pgd =kmalloc (pgd_size,GFP_KERNEL ); - -if (pgd) -memset (pgd,0 , pgd_size); - -return pgd; +return kcalloc (USER_PTRS_PER_PGD ,sizeof (pgd_t),GFP_KERNEL ); }static inline void pgd_free (pgd_t *pgd)
Haavard Skinnemoen
AppliedRe: [PATCH 62] include/asm-avr32/pgalloc.h: kmalloc + memset conversion to kcalloc
Quoted 1 line · On Tue, 31 Jul 2007 23:41:00 +0200 Mariusz Kozlowski <[email protected]>…
Signed-off-by Mariusz Kozlowski <[email protected]>
Applied, thanks. I found some other cruft in pgalloc.h which I cleaned up as well.
Haavard
PATCH 1/1 drivers/scsi/pluto.c: mostly kmalloc + memset conversion to kcalloc
In reply to Mariusz KozlowskiThis patch does kmalloc + memset conversion to kcalloc. Also the following warning is fixed.
CC drivers/scsi/pluto.o
drivers/scsi/pluto.c: In function 'pluto_info':
drivers/scsi/pluto.c:283: warning: unused variable 'p'
drivers/scsi/pluto.c | 8787 -> 8657 (-130 bytes) drivers/scsi/pluto.o | 125264 -> 124648 (-616 bytes)
drivers/scsi/pluto.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/scsi/pluto.c +13 -11
@@ -111,13 +111,12 @@ int __init pluto_detect(struct scsi_host#endif return 0 ; } - fcs =kmalloc (sizeof (struct ctrl_inquiry ) * fcscount,GFP_DMA ); + fcs =kcalloc (fcscount,sizeof (struct ctrl_inquiry ),GFP_DMA );if (!fcs) {printk ("PLUTO: Not enough memory to probe\n" );return 0 ; } -memset (fcs,0 ,sizeof (struct ctrl_inquiry ) * fcscount);memset (&dev,0 ,sizeof (dev));atomic_set (&fcss, fcscount);
@@ -211,12 +210,12 @@ int __init pluto_detect(struct scsi_hostchar *p;long *ages; - ages =kmalloc (((inq->channels +1 ) * inq->targets) *sizeof (long ),GFP_KERNEL ); -if (!ages)continue ; + ages =kcalloc ((inq->channels +1 ) * inq->targets,sizeof (long ),GFP_KERNEL ); +if (!ages) +continue ; host =scsi_register (tpnt,sizeof (struct pluto )); -if (!host) - { +if (!host) {kfree (ages);continue ; }
@@ -238,7 +237,6 @@ int __init pluto_detect(struct scsi_host fc->channels = inq->channels +1 ; fc->targets = inq->targets; fc->ages = ages; -memset (ages,0 , ((inq->channels +1 ) * inq->targets) *sizeof (long )); pluto->fc = fc;memcpy (pluto->rev_str, inq->revision,4 );
@@ -260,7 +258,7 @@ int __init pluto_detect(struct scsi_host }else fc->fcp_register (fc,TYPE_SCSI_FCP ,1 ); } -kfree ((char *)fcs); +kfree (fcs);if (nplutos)printk ("PLUTO: Total of %d SparcSTORAGE Arrays found\n" , nplutos);return nplutos;
@@ -282,15 +280,19 @@ int pluto_release(struct Scsi_Host *hostconst char *pluto_info (struct Scsi_Host *host) { -static char buf[128 ], *p; +static char buf[128 ];struct pluto *pluto = (struct pluto *) host->hostdata;sprintf (buf,"SUN SparcSTORAGE Array %s fw %s serial %s %dx%d on %s" , pluto->rev_str, pluto->fw_rev_str, pluto->serial_str, host->max_channel, host->max_id, pluto->fc->name);#ifdef __sparc__ - p =strchr (buf,0 ); -sprintf (p," PROM node %x" , pluto->fc->dev->prom_node); + { +char *p; + + p =strchr (buf,0 ); +sprintf (p," PROM node %x" , pluto->fc->dev->prom_node); + }#endif return buf; }
PATCH 1/1 drivers/mtd/maps/pmcmsp-flash.c: kmalloc + memset conversion to k[cz]alloc
In reply to Mariusz Kozlowski drivers/mtd/maps/pmcmsp-flash.c | 5540 -> 5454 (-86 bytes)
drivers/mtd/maps/pmcmsp-flash.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/mtd/maps/pmcmsp-flash.c +12 -10
@@ -73,13 +73,16 @@ int __init init_msp_flash(void)return -ENXIO ;printk (KERN_NOTICE "Found %d PMC flash devices\n" , fcnt); - msp_flash = (struct mtd_info **)kmalloc ( - fcnt *sizeof (struct map_info *),GFP_KERNEL ); - msp_parts = (struct mtd_partition **)kmalloc ( - fcnt *sizeof (struct mtd_partition *),GFP_KERNEL ); - msp_maps = (struct map_info *)kmalloc ( - fcnt *sizeof (struct mtd_info ),GFP_KERNEL ); -memset (msp_maps,0 , fcnt *sizeof (struct mtd_info )); + + msp_flash =kmalloc (fcnt *sizeof (struct map_info *),GFP_KERNEL ); + msp_parts =kmalloc (fcnt *sizeof (struct mtd_partition *),GFP_KERNEL ); + msp_maps =kcalloc (fcnt,sizeof (struct mtd_info ),GFP_KERNEL ); +if (!msp_flash || !msp_parts || !msp_maps) { +kfree (msp_maps); +kfree (msp_parts); +kfree (msp_flash); +return -ENOMEM ; + }/* loop over the flash devices, initializing each */ for (i =0 ; i < fcnt; i++) {
@@ -95,9 +98,8 @@ int __init init_msp_flash(void)continue ; } - msp_parts[i] = (struct mtd_partition *)kmalloc ( - pcnt *sizeof (struct mtd_partition ),GFP_KERNEL ); -memset (msp_parts[i],0 , pcnt *sizeof (struct mtd_partition )); + msp_parts[i] =kcalloc (pcnt,sizeof (struct mtd_partition ), +GFP_KERNEL );/* now initialize the devices proper */ flash_name[5 ] ='0' + i;
PATCH 1/1 drivers/scsi/qla2xxx/qla_init.c: mostly kmalloc + memset conversion to k[cz]alloc
In reply to Mariusz Kozlowski drivers/scsi/qla2xxx/qla_init.c | 107445 -> 107327 (-118 bytes) drivers/scsi/qla2xxx/qla_init.o | 237540 -> 237424 (-116 bytes)
drivers/scsi/qla2xxx/qla_init.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +6 -8
@@ -1787,12 +1787,11 @@ qla2x00_alloc_fcport(scsi_qla_host_t *ha {fc_port_t *fcport; - fcport =kmalloc (sizeof (fc_port_t), flags); -if (fcport =NULL ) -return (fcport); + fcport =kzalloc (sizeof (fc_port_t), flags); +if (!fcport) +return NULL ;/* Setup fcport template structure. */ -memset (fcport,0 ,sizeof (fc_port_t)); fcport->ha = ha; fcport->vp_idx = ha->vp_idx; fcport->port_type =FCT_UNKNOWN ;
@@ -1802,7 +1801,7 @@ qla2x00_alloc_fcport(scsi_qla_host_t *ha fcport->supported_classes =FC_COS_UNSPECIFIED ;spin_lock_init (&fcport->rport_lock); -return (fcport); +return fcport; }/*
@@ -2497,13 +2496,12 @@ qla2x00_find_all_fabric_devs(scsi_qla_ho rval =QLA_SUCCESS ;/* Try GID_PT to get device list, else GAN. */ - swl =kmalloc (sizeof (sw_info_t) *MAX_FIBRE_DEVICES ,GFP_ATOMIC ); -if (swl =NULL ) { + swl =kcalloc (MAX_FIBRE_DEVICES ,sizeof (sw_info_t),GFP_ATOMIC ); +if (!swl) {/*EMPTY*/ DEBUG2 (printk ("scsi(%ld): GID_PT allocations failed, fallback " "on GA_NXT\n" , ha->host_no)); }else { -memset (swl,0 ,sizeof (sw_info_t) *MAX_FIBRE_DEVICES );if (qla2x00_gid_pt (ha, swl) !=QLA_SUCCESS ) {kfree (swl); swl =NULL ;
Re: [PATCH 64] drivers/scsi/qla2xxx/qla_init.c: mostly kmalloc + memset conversion to k[cz]alloc
Quoted 7 lines · Mariusz Kozlowski
Signed-off-by Mariusz Kozlowski <[email protected]>
drivers/scsi/qla2xxx/qla_init.c| 107445 -> 107327 (-118 bytes)drivers/scsi/qla2xxx/qla_init.o| 237540 -> 237424 (-116 bytes)drivers/scsi/qla2xxx/qla_init.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
PATCH 1/1 net/ipv4/raw.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski net/ipv4/raw.c | 21650 -> 21628 (-22 bytes)
net/ipv4/raw.o | 179112 -> 179272 (+160 bytes)
net/ipv4/raw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/ipv4/raw.c +3 -3
@@ -900,8 +900,9 @@ static int raw_seq_open(struct inode *in {struct seq_file *seq;int rc = -ENOMEM ; -struct raw_iter_state *s =kmalloc (sizeof (*s),GFP_KERNEL ); - +struct raw_iter_state *s; + + s =kzalloc (sizeof (*s),GFP_KERNEL );if (!s) goto out; rc =seq_open (file, &raw_seq_ops);
@@ -910,7 +911,6 @@ static int raw_seq_open(struct inode *in seq = file->private_data; seq->private = s; -memset (s,0 ,sizeof (*s)); out:return rc; out_kfree:
Re: [PATCH 66] net/ipv4/raw.c: kmalloc + memset conversion to kzalloc
From: Mariusz Kozlowski <[email protected]>
Date: Tue, 31 Jul 2007 23:54:00 +0200
Quoted 1 line
Signed-off-by Mariusz Kozlowski <[email protected]>
Applied.
PATCH 1/1 net/ipv4/route.c: mostly kmalloc + memset conversion to k[cz]alloc
In reply to Mariusz Kozlowski net/ipv4/route.c | 75650 -> 75628 (-22 bytes)
net/ipv4/route.o | 256303 -> 256467 (+164 bytes)
net/ipv4/route.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/ipv4/route.c +3 -3
@@ -374,8 +374,9 @@ static int rt_cache_seq_open(struct inod {struct seq_file *seq;int rc = -ENOMEM ; -struct rt_cache_iter_state *s =kmalloc (sizeof (*s),GFP_KERNEL ); - +struct rt_cache_iter_state *s; + + s =kzalloc (sizeof (*s),GFP_KERNEL );if (!s) goto out; rc =seq_open (file, &rt_cache_seq_ops);
@@ -383,7 +384,6 @@ static int rt_cache_seq_open(struct inod goto out_kfree; seq = file->private_data; seq->private = s; -memset (s,0 ,sizeof (*s)); out:return rc; out_kfree:
Re: [PATCH 67] net/ipv4/route.c: mostly kmalloc + memset conversion to k[cz]alloc
From: Mariusz Kozlowski <[email protected]>
Date: Tue, 31 Jul 2007 23:55:02 +0200
Quoted 1 line
Signed-off-by Mariusz Kozlowski <[email protected]>
Applied.
PATCH 1/1 drivers/net/s2io.c: kmalloc + memset conversion to k[cz]alloc
In reply to Mariusz Kozlowski drivers/net/s2io.c | 235587 -> 235340 (-247 bytes) drivers/net/s2io.o | 460768 -> 460120 (-648 bytes)
drivers/net/s2io.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/net/s2io.c +5 -8
@@ -531,7 +531,7 @@ static int init_shared_mem(struct s2io_nfor (i =0 ; i < config->tx_fifo_num; i++) {int fifo_len = config->tx_cfg[i].fifo_len;int list_holder_size = fifo_len *sizeof (struct list_info_hold ); - mac_control->fifos[i].list_info =kmalloc (list_holder_size, + mac_control->fifos[i].list_info =kzalloc (list_holder_size,GFP_KERNEL );if (!mac_control->fifos[i].list_info) { DBG_PRINT(INFO_DBG,
@@ -539,7 +539,6 @@ static int init_shared_mem(struct s2io_nreturn -ENOMEM ; } mem_allocated += list_holder_size; -memset (mac_control->fifos[i].list_info,0 , list_holder_size); }for (i =0 ; i < config->tx_fifo_num; i++) { int page_num = TXD_MEM_PAGE_CNT(config->tx_cfg[i].fifo_len,
@@ -3788,9 +3787,9 @@ static int s2io_enable_msi_x(struct s2iou16 msi_control;/* Temp variable */ int ret, i, j, msix_indx =1 ; - nic->entries =kmalloc (MAX_REQUESTED_MSI_X *sizeof (struct msix_entry ), + nic->entries =kcalloc (MAX_REQUESTED_MSI_X ,sizeof (struct msix_entry ),GFP_KERNEL ); -if (nic->entries =NULL ) { +if (!nic->entries) {DBG_PRINT (INFO_DBG ,"%s: Memory allocation failed\n" , \ __FUNCTION__); nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++;
@@ -3798,12 +3797,11 @@ static int s2io_enable_msi_x(struct s2io } nic->mac_control.stats_info->sw_stat.mem_allocated += (MAX_REQUESTED_MSI_X *sizeof (struct msix_entry )); -memset (nic->entries,0 ,MAX_REQUESTED_MSI_X *sizeof (struct msix_entry )); nic->s2io_entries -kmalloc (MAX_REQUESTED_MSI_X *sizeof (struct s2io_msix_entry ), +kcalloc (MAX_REQUESTED_MSI_X ,sizeof (struct s2io_msix_entry ), GFP_KERNEL); -if (nic->s2io_entries =NULL ) { +if (!nic->s2io_entries) {DBG_PRINT (INFO_DBG ,"%s: Memory allocation failed\n" , __FUNCTION__); nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++;
@@ -3814,8 +3812,6 @@ static int s2io_enable_msi_x(struct s2io } nic->mac_control.stats_info->sw_stat.mem_allocated += (MAX_REQUESTED_MSI_X *sizeof (struct s2io_msix_entry )); -memset (nic->s2io_entries,0 , -MAX_REQUESTED_MSI_X *sizeof (struct s2io_msix_entry ));for (i=0 ; i<MAX_REQUESTED_MSI_X ; i++) { nic->entries[i].entry = i;
Re: [PATCH 68] drivers/net/s2io.c: kmalloc + memset conversion to k[cz]alloc
Quoted 7 lines · Mariusz Kozlowski
Signed-off-by Mariusz Kozlowski <[email protected]>
drivers/net/s2io.c| 235587 -> 235340 (-247 bytes)drivers/net/s2io.o| 460768 -> 460120 (-648 bytes)drivers/net/s2io.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
ACK but didn't apply, please wait 24-48 hours (so that s2io fixes go upstream), then rediff and resend
RE: [PATCH 68] drivers/net/s2io.c: kmalloc + memset conversion to k[cz]alloc
We have a few patches queued and can send this patch in along with ours.
Ram
Quoted 2 lines
-----Original Message-----
From: [email protected]
[mailto:[email protected]]
Quoted 4 lines
On Behalf Of Jeff Garzik
Sent: Tuesday, August 07, 2007 2:58 PM
To: Mariusz Kozlowski
Cc: [email protected]; [email protected];
Andrew
Quoted 2 lines
Morton; [email protected]
Subject: Re: [PATCH 68]drivers/net/s2io.c: kmalloc + memset
conversion to
Quoted 19 lines
k[cz]alloc
Quoted 7 lines · Mariusz Kozlowski
Signed-off-by Mariusz Kozlowski <[email protected]>
drivers/net/s2io.c| 235587 -> 235340 (-247 bytes)drivers/net/s2io.o| 460768 -> 460120 (-648 bytes)drivers/net/s2io.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)ACK but didn't apply, please wait 24-48 hours (so that s2io fixes go upstream), then rediff and resend
-
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 68] drivers/net/s2io.c: kmalloc + memset conversion to k[cz]alloc
Quoted 1 line · Ramkrishna Vepa
We have a few patches queued and can send this patch in along with ours.
That would be great, thanks.
Jeff
PATCH 1/1 drivers/net/sb1250-mac.c: kmalloc + memset conversion to kcalloc
In reply to Mariusz Kozlowski drivers/net/sb1250-mac.c | 76286 -> 76199 (-87 bytes)
drivers/net/sb1250-mac.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/sb1250-mac.c +2 -4
@@ -779,10 +779,8 @@ static void sbdma_initctx(sbmacdma_t *d,* And context table */ - d->sbdma_ctxtable = (struct sk_buff **) -kmalloc (d->sbdma_maxdescr*sizeof (struct sk_buff *),GFP_KERNEL ); - -memset (d->sbdma_ctxtable,0 ,d->sbdma_maxdescr*sizeof (struct sk_buff *)); + d->sbdma_ctxtable =kcalloc (d->sbdma_maxdescr, +sizeof (struct sk_buff *),GFP_KERNEL );#ifdef CONFIG_SBMAC_COALESCE /*
Jeff Garzik
AppliedRe: [PATCH 69] drivers/net/sb1250-mac.c: kmalloc + memset conversion to kcalloc
Quoted 6 lines · Mariusz Kozlowski
Signed-off-by Mariusz Kozlowski <[email protected]>
drivers/net/sb1250-mac.c| 76286 -> 76199 (-87 bytes)drivers/net/sb1250-mac.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
applied
PATCH 1/1 drivers/mtd/ubi/scan.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz KozlowskiTo be able to convert kmalloc + memset(..., 1, ...) to kzalloc this patch reverses the logic around 'buf'.
drivers/mtd/ubi/scan.c | 35563 -> 35531 (-32 bytes) drivers/mtd/ubi/scan.o | 125124 -> 124564 (-560 bytes)
drivers/mtd/ubi/scan.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/mtd/ubi/scan.c +8 -9
@@ -1314,11 +1314,10 @@ static int paranoid_check_si(const struc* Make sure that all the physical eraseblocks are in one of the lists * or trees. */ - buf =kmalloc (ubi->peb_count,GFP_KERNEL ); + buf =kzalloc (ubi->peb_count,GFP_KERNEL );if (!buf)return -ENOMEM ; -memset (buf,1 , ubi->peb_count);for (pnum =0 ; pnum < ubi->peb_count; pnum++) { err =ubi_io_is_bad (ubi, pnum);if (err <0 ) {
@@ -1326,28 +1325,28 @@ static int paranoid_check_si(const strucreturn err; }else if (err) - buf[pnum] =0 ; + buf[pnum] =1 ; }ubi_rb_for_each_entry (rb1, sv, &si->volumes, rb)ubi_rb_for_each_entry (rb2, seb, &sv->root, u.rb) - buf[seb->pnum] =0 ; + buf[seb->pnum] =1 ;list_for_each_entry (seb, &si->free, u.list) - buf[seb->pnum] =0 ; + buf[seb->pnum] =1 ;list_for_each_entry (seb, &si->corr, u.list) - buf[seb->pnum] =0 ; + buf[seb->pnum] =1 ;list_for_each_entry (seb, &si->erase, u.list) - buf[seb->pnum] =0 ; + buf[seb->pnum] =1 ;list_for_each_entry (seb, &si->alien, u.list) - buf[seb->pnum] =0 ; + buf[seb->pnum] =1 ; err =0 ;for (pnum =0 ; pnum < ubi->peb_count; pnum++) -if (buf[pnum]) { +if (!buf[pnum]) {ubi_err ("PEB %d is not referred" , pnum); err =1 ; }
PATCH 1/1 kernel/sched.c: kmalloc + memset conversion to kcalloc
In reply to Mariusz Kozlowski kernel/sched.c | 166559 -> 166517 (-42 bytes)
kernel/sched.o | 445965 -> 445941 (-24 bytes)
kernel/sched.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/sched.c +3 -2
@@ -5167,10 +5167,10 @@ static struct ctl_table sd_ctl_root[]static struct ctl_table *sd_alloc_ctl_entry (int n) { - struct ctl_table *entry - kmalloc(n * sizeof(struct ctl_table), GFP_KERNEL); +struct ctl_table *entry; + + entry =kcalloc (n,sizeof (struct ctl_table ),GFP_KERNEL );BUG_ON (!entry); -memset (entry,0 , n *sizeof (struct ctl_table ));return entry; }
PATCH 1/1 drivers/mmc/core/sdio_bus.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/mmc/core/sdio_bus.c | 5528 -> 5483 (-45 bytes) drivers/mmc/core/sdio_bus.o | 70044 -> 69876 (-168 bytes)
drivers/mmc/core/sdio_bus.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mmc/core/sdio_bus.c +1 -3
@@ -203,12 +203,10 @@ struct sdio_func *sdio_alloc_func(struct {struct sdio_func *func; - func =kmalloc (sizeof (struct sdio_func ),GFP_KERNEL ); + func =kzalloc (sizeof (struct sdio_func ),GFP_KERNEL );if (!func)return ERR_PTR (-ENOMEM ); -memset (func,0 ,sizeof (struct sdio_func )); - func->card = card;device_initialize (&func->dev);
Re: [PATCH 72] drivers/mmc/core/sdio_bus.c: kmalloc + memset conversion to kzalloc
Quoted 8 lines · On Wed, 1 Aug 2007 00:05:24 +0200 Mariusz Kozlowski <[email protected]>…
Signed-off-by Mariusz Kozlowski <[email protected]>
drivers/mmc/core/sdio_bus.c| 5528 -> 5483 (-45 bytes)drivers/mmc/core/sdio_bus.o| 70044 -> 69876 (-168 bytes)drivers/mmc/core/sdio_bus.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
Although this is code that only lives in my -mm tree. Should I carry this patch instead, perhaps?
Signature · 5 lines
-- Pierre Ossman Linux kernel, MMC maintainer http://www.kernel.org PulseAudio, core developer http://pulseaudio.org rdesktop, core developer http://www.rdesktop.org
Andrew Morton
maintainerRe: [PATCH 72] drivers/mmc/core/sdio_bus.c: kmalloc + memset conversion to kzalloc
Quoted 8 lines · On Sat, 4 Aug 2007 15:03:34 +0200 Pierre Ossman <[email protected]> wrote:
Quoted 5 lines · On Wed, 1 Aug 2007 00:05:24 +0200 Mariusz Kozlowski <[email protected]>…
Signed-off-by Mariusz Kozlowski <[email protected]>
drivers/mmc/core/sdio_bus.c| 5528 -> 5483 (-45 bytes)drivers/mmc/core/sdio_bus.o| 70044 -> 69876 (-168 bytes)
Quoted 9 lines
Quoted 3 lines
drivers/mmc/core/sdio_bus.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)Acked-by Pierre Ossman <[email protected]>Although this is code that only lives in my -mm tree. Should I carry this patch instead, perhaps?
Yes please. I always get confused when a git-tree maintainer says "Acked-by" rather than "applied, thanks".
But I have these queued in my to-send-to-Pierre-regularly queue, so things will sort themselves out.
PATCH 1/1 drivers/parport/share.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/parport/share.c | 29584 -> 29542 (-42 bytes) drivers/parport/share.o | 117775 -> 117795 (+20 bytes)
drivers/parport/share.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/parport/share.c +1 -2
@@ -282,14 +282,13 @@ struct parport *parport_register_port(unint device;char *name; - tmp =kmalloc (sizeof (struct parport ),GFP_KERNEL ); + tmp =kzalloc (sizeof (struct parport ),GFP_KERNEL );if (!tmp) {printk (KERN_WARNING "parport: memory squeeze\n" );return NULL ; }/* Init our structure */ -memset (tmp,0 ,sizeof (struct parport )); tmp->base = base; tmp->irq = irq; tmp->dma = dma;
PATCH 1/1 include/linux/textsearch.h: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowskiinclude/linux/textsearch.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
include/linux/textsearch.h +2 -3
@@ -164,11 +164,10 @@ static inline struct ts_config *alloc_ts {struct ts_config *conf; - conf =kmalloc (TS_PRIV_ALIGN (sizeof (*conf)) + payload, gfp_mask); -if (conf =NULL ) + conf =kzalloc (TS_PRIV_ALIGN (sizeof (*conf)) + payload, gfp_mask); +if (!conf)return ERR_PTR (-ENOMEM ); -memset (conf,0 ,TS_PRIV_ALIGN (sizeof (*conf)) + payload);return conf; }
PATCH 1/1 drivers/macintosh/therm_adt746x.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/macintosh/therm_adt746x.c | 17298 -> 17244 (-54 bytes)
drivers/macintosh/therm_adt746x.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/macintosh/therm_adt746x.c +1 -4
@@ -379,13 +379,10 @@ static int attach_one_thermostat(structif (thermostat)return 0 ; - th = (struct thermostat *) -kmalloc (sizeof (struct thermostat ),GFP_KERNEL ); - + th =kzalloc (sizeof (struct thermostat ),GFP_KERNEL );if (!th)return -ENOMEM ; -memset (th,0 ,sizeof (*th)); th->clt.addr = addr; th->clt.adapter = adapter; th->clt.driver = &thermostat_driver;
PATCH 1/1 drivers/net/via-velocity.c: mostly kmalloc + memset conversion to kcalloc
In reply to Mariusz Kozlowski drivers/net/via-velocity.c | 88263 -> 88120 (-143 bytes) drivers/net/via-velocity.o | 254264 -> 253828 (-436 bytes)
drivers/net/via-velocity.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-)
drivers/net/via-velocity.c +10 -14
@@ -1071,14 +1071,12 @@ static int velocity_rx_refill(struct velstatic int velocity_init_rd_ring (struct velocity_info *vptr) { -int ret = -ENOMEM ; -unsigned int rsize =sizeof (struct velocity_rd_info ) * - vptr->options.numrx; +int ret; - vptr->rd_info =kmalloc (rsize,GFP_KERNEL ); -if (vptr->rd_info =NULL ) - goto out; -memset (vptr->rd_info,0 , rsize); + vptr->rd_info =kcalloc (vptr->options.numrx, +sizeof (struct velocity_rd_info ),GFP_KERNEL ); +if (!vptr->rd_info) +return -ENOMEM ; vptr->rd_filled = vptr->rd_dirty = vptr->rd_curr =0 ;
@@ -1088,7 +1086,7 @@ static int velocity_init_rd_ring(struct "%s: failed to allocate RX buffer.\n", vptr->dev->name);velocity_free_rd_ring (vptr); } -out: +return ret; }
@@ -1142,21 +1140,19 @@ static int velocity_init_td_ring(structdma_addr_t curr;struct tx_desc *td;struct velocity_td_info *td_info; -unsigned int tsize =sizeof (struct velocity_td_info ) * - vptr->options.numtx;/* Init the TD ring entries */ for (j =0 ; j < vptr->num_txq; j++) { curr = vptr->td_pool_dma[j]; - vptr->td_infos[j] =kmalloc (tsize,GFP_KERNEL ); -if (vptr->td_infos[j] =NULL ) - { + vptr->td_infos[j] =kcalloc (vptr->options.numtx, +sizeof (struct velocity_td_info ), +GFP_KERNEL ); +if (!vptr->td_infos[j]) {while (--j >=0 )kfree (vptr->td_infos[j]);return -ENOMEM ; } -memset (vptr->td_infos[j],0 , tsize);for (i =0 ; i < vptr->options.numtx; i++, curr +=sizeof (struct tx_desc )) { td = &(vptr->td_rings[j][i]);
Re: [PATCH 76] drivers/net/via-velocity.c: mostly kmalloc + memset conversion to kcalloc
Mariusz Kozlowski <[email protected]> :
Quoted 7 lines
Signed-off-by Mariusz Kozlowski <[email protected]>
drivers/net/via-velocity.c| 88263 -> 88120 (-143 bytes)drivers/net/via-velocity.o| 254264 -> 253828 (-436 bytes)drivers/net/via-velocity.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-)
Signature · 1 line
Ueimor
Jeff Garzik
AppliedRe: [PATCH 76] drivers/net/via-velocity.c: mostly kmalloc + memset conversion to kcalloc
In reply to Mariusz KozlowskiQuoted 7 lines · Mariusz Kozlowski
Signed-off-by Mariusz Kozlowski <[email protected]>
drivers/net/via-velocity.c| 88263 -> 88120 (-143 bytes)drivers/net/via-velocity.o| 254264 -> 253828 (-436 bytes)drivers/net/via-velocity.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-)
applied
PATCH 1/1 sound/oss/via82cxxx_audio.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski sound/oss/via82cxxx_audio.c | 91182 -> 91145 (-37 bytes) sound/oss/via82cxxx_audio.o | 180104 -> 179984 (-120 bytes)
sound/oss/via82cxxx_audio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/oss/via82cxxx_audio.c +1 -2
@@ -3401,7 +3401,7 @@ static int __devinit via_init_one (strucif (rc) goto err_out_res; - card =kmalloc (sizeof (*card),GFP_KERNEL ); + card =kzalloc (sizeof (*card),GFP_KERNEL );if (!card) { printk (KERN_ERR PFX "out of memory, aborting\n"); rc = -ENOMEM ;
@@ -3410,7 +3410,6 @@ static int __devinit via_init_one (strucpci_set_drvdata (pdev, card); -memset (card,0 ,sizeof (*card)); card->pdev = pdev; card->baseaddr =pci_resource_start (pdev,0 ); card->card_num = via_num_cards++;
PATCH 1/1 fs/proc/vmcore.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski fs/proc/vmcore.c | 16780 -> 16727 (-53 bytes)
fs/proc/vmcore.o | 113032 -> 112744 (-288 bytes)
fs/proc/vmcore.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
fs/proc/vmcore.c +1 -6
@@ -178,12 +178,7 @@ const struct file_operations proc_vmcorestatic struct vmcore *__init get_new_element (void ) { -struct vmcore *p; - - p =kmalloc (sizeof (*p),GFP_KERNEL ); -if (p) -memset (p,0 ,sizeof (*p)); -return p; +return kzalloc (sizeof (struct vmcore ),GFP_KERNEL ); }static u64 __init get_vmcore_size_elf64 (char *elfptr)
PATCH 1/1 arch/i386/mach-voyager/voyager_cat.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski arch/i386/mach-voyager/voyager_cat.c | 35688 -> 35576 (-112 bytes) arch/i386/mach-voyager/voyager_cat.o | 151452 -> 150992 (-460 bytes)
arch/i386/mach-voyager/voyager_cat.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
arch/i386/mach-voyager/voyager_cat.c +4 -6
@@ -648,20 +648,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++];*/ -if (*modpp =NULL ) { + *modpp =kzalloc (sizeof (voyager_module_t),GFP_KERNEL );/*&voyager_module_storage[cat_count++];*/ +if (!*modpp) {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];*/ -if ((*modpp)->asic =NULL ) { + (*modpp)->asic =kzalloc (sizeof (voyager_asic_t),GFP_KERNEL );/*&voyager_asic_storage[asic_count];*/ +if (!(*modpp)->asic) {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;
PATCH 1/1 fs/ext4/xattr.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski fs/ext4/xattr.c | 42421 -> 42382 (-39 bytes)
fs/ext4/xattr.o | 166152 -> 165720 (-432 bytes)
fs/ext4/xattr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/ext4/xattr.c +1 -2
@@ -750,12 +750,11 @@ ext4_xattr_block_set(handle_t *handle, s } }else {/* Allocate a buffer where we construct the new block. */ - s->base =kmalloc (sb->s_blocksize,GFP_KERNEL ); + s->base =kzalloc (sb->s_blocksize,GFP_KERNEL );/* assert(header = s->base) */ error = -ENOMEM ;if (s->base =NULL ) goto cleanup; -memset (s->base,0 , sb->s_blocksize);header (s->base)->h_magic =cpu_to_le32 (EXT4_XATTR_MAGIC );header (s->base)->h_blocks =cpu_to_le32 (1 );header (s->base)->h_refcount =cpu_to_le32 (1 );
PATCH 1/1 drivers/net/wireless/zd1201.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/net/wireless/zd1201.c | 47231 -> 47205 (-26 bytes) drivers/net/wireless/zd1201.o | 216884 -> 216984 (+100 bytes)
drivers/net/wireless/zd1201.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/zd1201.c +1 -2
@@ -522,7 +522,7 @@ static int zd1201_setconfig(struct zd120 zd->rxdatas =0 ; zd->rxlen =0 ;for (seq=0 ; len >0 ; seq++) { - request =kmalloc (16 , gfp_mask); + request =kzalloc (16 , gfp_mask);if (!request)return -ENOMEM ; urb =usb_alloc_urb (0 , gfp_mask);
@@ -530,7 +530,6 @@ static int zd1201_setconfig(struct zd120kfree (request);return -ENOMEM ; } -memset (request,0 ,16 ); reqlen = len>12 ?12 : len; request[0 ] =ZD1201_USB_RESREQ ; request[1 ] = seq;
PATCH 1/1 drivers/scsi/zorro7xx.c: kmalloc + memset conversion to kzalloc
In reply to Mariusz Kozlowski drivers/scsi/zorro7xx.c | 4579 -> 4501 (-78 bytes)
drivers/scsi/zorro7xx.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/scsi/zorro7xx.c +3 -5
@@ -69,7 +69,7 @@ static struct zorro_device_id zorro7xx_zstatic int __devinit zorro7xx_init_one (struct zorro_dev *z,const struct zorro_device_id *ent) { -struct Scsi_Host * host =NULL ; +struct Scsi_Host *host;struct NCR_700_Host_Parameters *hostdata;struct zorro_driver_data *zdd;unsigned long board, ioaddr;
@@ -89,14 +89,12 @@ static int __devinit zorro7xx_init_one(sreturn -EBUSY ; } - hostdata =kmalloc (sizeof (struct NCR_700_Host_Parameters ),GFP_KERNEL ); -if (hostdata =NULL ) { + hostdata =kzalloc (sizeof (struct NCR_700_Host_Parameters ),GFP_KERNEL ); +if (!hostdata) {printk (KERN_ERR "zorro7xx: Failed to allocate host data\n" ); goto out_release; } -memset (hostdata,0 ,sizeof (struct NCR_700_Host_Parameters )); -/* Fill in the required pieces of hostdata */ if (ioaddr >0x01000000 ) hostdata->base =ioremap (ioaddr,zorro_resource_len (z));
Re: [PATCH 82] drivers/scsi/zorro7xx.c: kmalloc + memset conversion to kzalloc
Quoted 1 line · Mariusz Kozlowski
[PATCH 82] ...
Please no. This should be a simple mechanical substitution. I don't need to collect acks from everyone. This is a nice point to do a conversion like this, so I'll sort out the mismerges.
Please assure me you have a good methodology for doing the replacement and a reasonable one for testing and then send either one patch for the entirety of SCSI to me, or one patch for the entirety of the kernel to Andrew and we'll see if we can get it through the process.
James