linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01] kmalloc + memset conversion co kzalloc
       [not found] <200707311845.48807.m.kozlowski@tuxland.pl>
@ 2007-07-31 16:50 ` Mariusz Kozlowski
  2007-07-31 16:52 ` [PATCH 02] kmalloc + memset conversion to kzalloc Mariusz Kozlowski
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: Mariusz Kozlowski @ 2007-07-31 16:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors, Andrew Morton, linux-scsi, Kars de Jong

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>

 drivers/scsi/a4000t.c | 3534 -> 3457 (-77 bytes)

 drivers/scsi/a4000t.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

--- linux-2.6.23-rc1-mm1-a/drivers/scsi/a4000t.c	2007-07-26 13:07:42.000000000 +0200
+++ linux-2.6.23-rc1-mm1-b/drivers/scsi/a4000t.c	2007-07-31 14:00:37.000000000 +0200
@@ -37,7 +37,7 @@ static struct platform_device *a4000t_sc

 static 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);

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 02] kmalloc + memset conversion to kzalloc
       [not found] <200707311845.48807.m.kozlowski@tuxland.pl>
  2007-07-31 16:50 ` [PATCH 01] kmalloc + memset conversion co kzalloc Mariusz Kozlowski
@ 2007-07-31 16:52 ` Mariusz Kozlowski
  2007-07-31 17:01 ` [PATCH 06] drivers/scsi/bvme6000_scsi.c: " Mariusz Kozlowski
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: Mariusz Kozlowski @ 2007-07-31 16:52 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors, Andrew Morton, linux-scsi

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>

 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(-)

--- linux-2.6.23-rc1-mm1-a/drivers/scsi/aic7xxx_old.c	2007-07-26 13:07:42.000000000 +0200
+++ linux-2.6.23-rc1-mm1-b/drivers/scsi/aic7xxx_old.c	2007-07-31 14:03:31.000000000 +0200
@@ -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_template
             printk(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;

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 06] drivers/scsi/bvme6000_scsi.c: kmalloc + memset conversion to kzalloc
       [not found] <200707311845.48807.m.kozlowski@tuxland.pl>
  2007-07-31 16:50 ` [PATCH 01] kmalloc + memset conversion co kzalloc Mariusz Kozlowski
  2007-07-31 16:52 ` [PATCH 02] kmalloc + memset conversion to kzalloc Mariusz Kozlowski
@ 2007-07-31 17:01 ` Mariusz Kozlowski
  2007-07-31 17:35 ` [PATCH 21] drivers/scsi/dpt_i2o.c: " Mariusz Kozlowski
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: Mariusz Kozlowski @ 2007-07-31 17:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors, Andrew Morton, linux-scsi, Richard Hirst

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>

 drivers/scsi/bvme6000_scsi.c | 3330 -> 3253 (-77 bytes)

 drivers/scsi/bvme6000_scsi.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

--- linux-2.6.23-rc1-mm1-a/drivers/scsi/bvme6000_scsi.c	2007-07-26 13:07:42.000000000 +0200
+++ linux-2.6.23-rc1-mm1-b/drivers/scsi/bvme6000_scsi.c	2007-07-31 14:04:50.000000000 +0200
@@ -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;

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 21] drivers/scsi/dpt_i2o.c: kmalloc + memset conversion to kzalloc
       [not found] <200707311845.48807.m.kozlowski@tuxland.pl>
                   ` (2 preceding siblings ...)
  2007-07-31 17:01 ` [PATCH 06] drivers/scsi/bvme6000_scsi.c: " Mariusz Kozlowski
@ 2007-07-31 17:35 ` Mariusz Kozlowski
  2007-07-31 17:45   ` Salyzyn, Mark
  2007-07-31 17:46 ` [PATCH 26] drivers/scsi/gdth.c: " Mariusz Kozlowski
                   ` (12 subsequent siblings)
  16 siblings, 1 reply; 27+ messages in thread
From: Mariusz Kozlowski @ 2007-07-31 17:35 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors, Andrew Morton, linux-scsi, aacraid

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>

 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(-)

--- linux-2.6.23-rc1-mm1-a/drivers/scsi/dpt_i2o.c	2007-07-26 13:07:42.000000000 +0200
+++ linux-2.6.23-rc1-mm1-b/drivers/scsi/dpt_i2o.c	2007-07-31 11:17:32.000000000 +0200
@@ -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(adpt

 	kfree(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(void

 	kfree(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;

^ permalink raw reply	[flat|nested] 27+ messages in thread

* RE: [PATCH 21] drivers/scsi/dpt_i2o.c: kmalloc + memset conversion to kzalloc
  2007-07-31 17:35 ` [PATCH 21] drivers/scsi/dpt_i2o.c: " Mariusz Kozlowski
@ 2007-07-31 17:45   ` Salyzyn, Mark
  0 siblings, 0 replies; 27+ messages in thread
From: Salyzyn, Mark @ 2007-07-31 17:45 UTC (permalink / raw)
  To: Mariusz Kozlowski, linux-kernel
  Cc: kernel-janitors, Andrew Morton, linux-scsi

ACK

Looks good and ultra-light on side effects!

Sincerely -- Mark Salyzyn

> -----Original Message-----
> From: Mariusz Kozlowski [mailto:m.kozlowski@tuxland.pl] 
> Sent: Tuesday, July 31, 2007 1:35 PM
> To: linux-kernel@vger.kernel.org
> Cc: kernel-janitors@vger.kernel.org; Andrew Morton; 
> linux-scsi@vger.kernel.org; AACRAID
> Subject: [PATCH 21] drivers/scsi/dpt_i2o.c: kmalloc + memset 
> conversion to kzalloc
> 
> Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
> 
>  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(-)

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 26] drivers/scsi/gdth.c: kmalloc + memset conversion to kzalloc
       [not found] <200707311845.48807.m.kozlowski@tuxland.pl>
                   ` (3 preceding siblings ...)
  2007-07-31 17:35 ` [PATCH 21] drivers/scsi/dpt_i2o.c: " Mariusz Kozlowski
@ 2007-07-31 17:46 ` Mariusz Kozlowski
  2007-07-31 18:01 ` [PATCH 31] drivers/scsi/ide-scsi.c: " Mariusz Kozlowski
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: Mariusz Kozlowski @ 2007-07-31 17:46 UTC (permalink / raw)
  To: linux-kernel
  Cc: kernel-janitors, Andrew Morton, linux-scsi, achim_leubner,
	boji.t.kannanthanam, johannes_dinner

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>

 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(-)

--- linux-2.6.23-rc1-mm1-a/drivers/scsi/gdth.c	2007-07-26 13:07:42.000000000 +0200
+++ linux-2.6.23-rc1-mm1-b/drivers/scsi/gdth.c	2007-07-31 14:08:37.000000000 +0200
@@ -458,10 +458,10 @@ int __gdth_execute(struct scsi_device *s
     DECLARE_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;

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 31] drivers/scsi/ide-scsi.c: kmalloc + memset conversion to kzalloc
       [not found] <200707311845.48807.m.kozlowski@tuxland.pl>
                   ` (4 preceding siblings ...)
  2007-07-31 17:46 ` [PATCH 26] drivers/scsi/gdth.c: " Mariusz Kozlowski
@ 2007-07-31 18:01 ` Mariusz Kozlowski
  2007-08-01 21:02   ` Bartlomiej Zolnierkiewicz
  2007-07-31 18:25 ` [PATCH 44] drivers/scsi/lpfc/lpfc_debugfs.c: kmalloc + memset conversion to kcalloc Mariusz Kozlowski
                   ` (10 subsequent siblings)
  16 siblings, 1 reply; 27+ messages in thread
From: Mariusz Kozlowski @ 2007-07-31 18:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors, Andrew Morton, linux-scsi

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>

 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(-)

--- linux-2.6.23-rc1-mm1-a/drivers/scsi/ide-scsi.c	2007-07-26 13:07:42.000000000 +0200
+++ linux-2.6.23-rc1-mm1-b/drivers/scsi/ide-scsi.c	2007-07-31 14:09:51.000000000 +0200
@@ -328,17 +328,15 @@ static int idescsi_check_condition(ide_d
 	u8             *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;

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 44] drivers/scsi/lpfc/lpfc_debugfs.c: kmalloc + memset conversion to kcalloc
       [not found] <200707311845.48807.m.kozlowski@tuxland.pl>
                   ` (5 preceding siblings ...)
  2007-07-31 18:01 ` [PATCH 31] drivers/scsi/ide-scsi.c: " Mariusz Kozlowski
@ 2007-07-31 18:25 ` Mariusz Kozlowski
  2007-08-03 15:42   ` James Smart
  2007-07-31 18:26 ` [PATCH 45] drivers/scsi/lpfc/lpfc_init.c: " Mariusz Kozlowski
                   ` (9 subsequent siblings)
  16 siblings, 1 reply; 27+ messages in thread
From: Mariusz Kozlowski @ 2007-07-31 18:25 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors, Andrew Morton, james.smart, linux-scsi

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>

 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(-)

--- linux-2.6.23-rc1-mm1-a/drivers/scsi/lpfc/lpfc_debugfs.c	2007-07-26 13:07:42.000000000 +0200
+++ linux-2.6.23-rc1-mm1-b/drivers/scsi/lpfc/lpfc_debugfs.c	2007-07-31 14:11:24.000000000 +0200
@@ -432,14 +432,11 @@ lpfc_debugfs_initialize(struct lpfc_vpor
 	if (!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 =

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 45] drivers/scsi/lpfc/lpfc_init.c: kmalloc + memset conversion to kcalloc
       [not found] <200707311845.48807.m.kozlowski@tuxland.pl>
                   ` (6 preceding siblings ...)
  2007-07-31 18:25 ` [PATCH 44] drivers/scsi/lpfc/lpfc_debugfs.c: kmalloc + memset conversion to kcalloc Mariusz Kozlowski
@ 2007-07-31 18:26 ` Mariusz Kozlowski
  2007-08-03 15:41   ` James Smart
  2007-07-31 18:27 ` [PATCH 46] drivers/scsi/lpfc/lpfc_scsi.c: kmalloc + memset conversion to kzalloc Mariusz Kozlowski
                   ` (8 subsequent siblings)
  16 siblings, 1 reply; 27+ messages in thread
From: Mariusz Kozlowski @ 2007-07-31 18:26 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors, Andrew Morton, james.smart, linux-scsi

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>

 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(-)

--- linux-2.6.23-rc1-mm1-a/drivers/scsi/lpfc/lpfc_init.c	2007-07-26 13:07:42.000000000 +0200
+++ linux-2.6.23-rc1-mm1-b/drivers/scsi/lpfc/lpfc_init.c	2007-07-31 11:07:59.000000000 +0200
@@ -1280,11 +1280,10 @@ lpfc_hba_init(struct lpfc_hba *phba, uin
 	uint32_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;


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 46] drivers/scsi/lpfc/lpfc_scsi.c: kmalloc + memset conversion to kzalloc
       [not found] <200707311845.48807.m.kozlowski@tuxland.pl>
                   ` (7 preceding siblings ...)
  2007-07-31 18:26 ` [PATCH 45] drivers/scsi/lpfc/lpfc_init.c: " Mariusz Kozlowski
@ 2007-07-31 18:27 ` Mariusz Kozlowski
  2007-08-03 15:41   ` James Smart
  2007-07-31 18:34 ` [PATCH 47] drivers/scsi/megaraid.c: " Mariusz Kozlowski
                   ` (7 subsequent siblings)
  16 siblings, 1 reply; 27+ messages in thread
From: Mariusz Kozlowski @ 2007-07-31 18:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors, Andrew Morton, james.smart, linux-scsi

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>

 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(-)

--- linux-2.6.23-rc1-mm1-a/drivers/scsi/lpfc/lpfc_scsi.c	2007-07-26 13:07:42.000000000 +0200
+++ linux-2.6.23-rc1-mm1-b/drivers/scsi/lpfc/lpfc_scsi.c	2007-07-31 11:08:46.000000000 +0200
@@ -208,10 +208,9 @@ lpfc_new_scsi_buf(struct lpfc_vport *vpo
 	dma_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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 47] drivers/scsi/megaraid.c: kmalloc + memset conversion to kzalloc
       [not found] <200707311845.48807.m.kozlowski@tuxland.pl>
                   ` (8 preceding siblings ...)
  2007-07-31 18:27 ` [PATCH 46] drivers/scsi/lpfc/lpfc_scsi.c: kmalloc + memset conversion to kzalloc Mariusz Kozlowski
@ 2007-07-31 18:34 ` Mariusz Kozlowski
  2007-07-31 18:54 ` [PATCH 50] drivers/message/fusion/mptctl.c: mostly " Mariusz Kozlowski
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: Mariusz Kozlowski @ 2007-07-31 18:34 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors, Andrew Morton, linux-scsi, megaraidlinux

This patch does kmalloc + memset conversion to kzalloc and adds missing check for
kzaloc return value.

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>

 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(-)

--- linux-2.6.23-rc1-mm1-a/drivers/scsi/megaraid.c	2007-07-26 13:07:42.000000000 +0200
+++ linux-2.6.23-rc1-mm1-b/drivers/scsi/megaraid.c	2007-07-31 11:11:58.000000000 +0200
@@ -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;

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 50] drivers/message/fusion/mptctl.c: mostly kmalloc + memset conversion to kzalloc
       [not found] <200707311845.48807.m.kozlowski@tuxland.pl>
                   ` (9 preceding siblings ...)
  2007-07-31 18:34 ` [PATCH 47] drivers/scsi/megaraid.c: " Mariusz Kozlowski
@ 2007-07-31 18:54 ` Mariusz Kozlowski
  2007-07-31 21:23 ` [PATCH 54] drivers/scsi/mvme16x_scsi.c: " Mariusz Kozlowski
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: Mariusz Kozlowski @ 2007-07-31 18:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: kernel-janitors, Andrew Morton, support, mpt_linux_developer,
	linux-scsi

This patch does kmalloc + memset conversion to kzalloc and simplifies mptctl_probe().

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>

 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(-)

--- linux-2.6.23-rc1-mm1-a/drivers/message/fusion/mptctl.c	2007-07-26 13:07:44.000000000 +0200
+++ linux-2.6.23-rc1-mm1-b/drivers/message/fusion/mptctl.c	2007-07-31 18:02:38.000000000 +0200
@@ -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 fi
 static 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;
 }

 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 54] drivers/scsi/mvme16x_scsi.c: kmalloc + memset conversion to kzalloc
       [not found] <200707311845.48807.m.kozlowski@tuxland.pl>
                   ` (10 preceding siblings ...)
  2007-07-31 18:54 ` [PATCH 50] drivers/message/fusion/mptctl.c: mostly " Mariusz Kozlowski
@ 2007-07-31 21:23 ` Mariusz Kozlowski
  2007-07-31 21:29 ` [PATCH 56] drivers/scsi/NCR_D700.c: " Mariusz Kozlowski
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: Mariusz Kozlowski @ 2007-07-31 21:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors, Andrew Morton, linux-scsi, jongk

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>

 drivers/scsi/mvme16x_scsi.c | 3740 -> 3678 (-62 bytes)

 drivers/scsi/mvme16x_scsi.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- linux-2.6.23-rc1-mm1-a/drivers/scsi/mvme16x_scsi.c	2007-07-26 13:07:42.000000000 +0200
+++ linux-2.6.23-rc1-mm1-b/drivers/scsi/mvme16x_scsi.c	2007-07-31 11:02:11.000000000 +0200
@@ -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;

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 56] drivers/scsi/NCR_D700.c: kmalloc + memset conversion to kzalloc
       [not found] <200707311845.48807.m.kozlowski@tuxland.pl>
                   ` (11 preceding siblings ...)
  2007-07-31 21:23 ` [PATCH 54] drivers/scsi/mvme16x_scsi.c: " Mariusz Kozlowski
@ 2007-07-31 21:29 ` Mariusz Kozlowski
  2007-07-31 21:37 ` [PATCH 61] drivers/scsi/osst.c: " Mariusz Kozlowski
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: Mariusz Kozlowski @ 2007-07-31 21:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors, Andrew Morton, linux-scsi, James.Bottomley

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>

 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(-)

--- linux-2.6.23-rc1-mm1-a/drivers/scsi/NCR_D700.c	2007-07-26 13:07:42.000000000 +0200
+++ linux-2.6.23-rc1-mm1-b/drivers/scsi/NCR_D700.c	2007-07-31 11:13:37.000000000 +0200
@@ -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)) {

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 61] drivers/scsi/osst.c: kmalloc + memset conversion to kzalloc
       [not found] <200707311845.48807.m.kozlowski@tuxland.pl>
                   ` (12 preceding siblings ...)
  2007-07-31 21:29 ` [PATCH 56] drivers/scsi/NCR_D700.c: " Mariusz Kozlowski
@ 2007-07-31 21:37 ` Mariusz Kozlowski
  2007-07-31 21:46 ` [PATCH 63] drivers/scsi/pluto.c: mostly kmalloc + memset conversion to kcalloc Mariusz Kozlowski
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: Mariusz Kozlowski @ 2007-07-31 21:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: kernel-janitors, Andrew Morton, James.Bottomley, linux-scsi, osst

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>

 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(-)

--- linux-2.6.23-rc1-mm1-a/drivers/scsi/osst.c	2007-07-26 13:07:42.000000000 +0200
+++ linux-2.6.23-rc1-mm1-b/drivers/scsi/osst.c	2007-07-31 14:14:52.000000000 +0200
@@ -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;

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 63] drivers/scsi/pluto.c: mostly kmalloc + memset conversion to kcalloc
       [not found] <200707311845.48807.m.kozlowski@tuxland.pl>
                   ` (13 preceding siblings ...)
  2007-07-31 21:37 ` [PATCH 61] drivers/scsi/osst.c: " Mariusz Kozlowski
@ 2007-07-31 21:46 ` Mariusz Kozlowski
  2007-07-31 21:51 ` [PATCH 64] drivers/scsi/qla2xxx/qla_init.c: mostly kmalloc + memset conversion to k[cz]alloc Mariusz Kozlowski
  2007-07-31 22:21 ` [PATCH 82] drivers/scsi/zorro7xx.c: kmalloc + memset conversion to kzalloc Mariusz Kozlowski
  16 siblings, 0 replies; 27+ messages in thread
From: Mariusz Kozlowski @ 2007-07-31 21:46 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors, Andrew Morton, James.Bottomley, linux-scsi

This 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'

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>

 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(-)

--- linux-2.6.23-rc1-mm1-a/drivers/scsi/pluto.c	2007-07-26 13:07:42.000000000 +0200
+++ linux-2.6.23-rc1-mm1-b/drivers/scsi/pluto.c	2007-07-31 18:18:38.000000000 +0200
@@ -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_host
 				char *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 *host

 const 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;
 }

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 64] drivers/scsi/qla2xxx/qla_init.c: mostly kmalloc + memset conversion to k[cz]alloc
       [not found] <200707311845.48807.m.kozlowski@tuxland.pl>
                   ` (14 preceding siblings ...)
  2007-07-31 21:46 ` [PATCH 63] drivers/scsi/pluto.c: mostly kmalloc + memset conversion to kcalloc Mariusz Kozlowski
@ 2007-07-31 21:51 ` Mariusz Kozlowski
  2007-07-31 22:00   ` Andrew Vasquez
  2007-07-31 22:21 ` [PATCH 82] drivers/scsi/zorro7xx.c: kmalloc + memset conversion to kzalloc Mariusz Kozlowski
  16 siblings, 1 reply; 27+ messages in thread
From: Mariusz Kozlowski @ 2007-07-31 21:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors, Andrew Morton, linux-driver, linux-scsi

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>

 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(-)

--- linux-2.6.23-rc1-mm1-a/drivers/scsi/qla2xxx/qla_init.c	2007-07-26 13:07:42.000000000 +0200
+++ linux-2.6.23-rc1-mm1-b/drivers/scsi/qla2xxx/qla_init.c	2007-07-31 14:24:51.000000000 +0200
@@ -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;

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 64] drivers/scsi/qla2xxx/qla_init.c: mostly kmalloc + memset conversion to k[cz]alloc
  2007-07-31 21:51 ` [PATCH 64] drivers/scsi/qla2xxx/qla_init.c: mostly kmalloc + memset conversion to k[cz]alloc Mariusz Kozlowski
@ 2007-07-31 22:00   ` Andrew Vasquez
  0 siblings, 0 replies; 27+ messages in thread
From: Andrew Vasquez @ 2007-07-31 22:00 UTC (permalink / raw)
  To: Mariusz Kozlowski
  Cc: linux-kernel, kernel-janitors, Andrew Morton, linux-driver,
	linux-scsi

On Tue, 31 Jul 2007, Mariusz Kozlowski wrote:

> Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
> 
>  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(-)

Acked-by: Andrew Vasquez <andrew.vasquez@qlogic.com>

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 82] drivers/scsi/zorro7xx.c: kmalloc + memset conversion to kzalloc
       [not found] <200707311845.48807.m.kozlowski@tuxland.pl>
                   ` (15 preceding siblings ...)
  2007-07-31 21:51 ` [PATCH 64] drivers/scsi/qla2xxx/qla_init.c: mostly kmalloc + memset conversion to k[cz]alloc Mariusz Kozlowski
@ 2007-07-31 22:21 ` Mariusz Kozlowski
  2007-08-01 16:11   ` James Bottomley
  16 siblings, 1 reply; 27+ messages in thread
From: Mariusz Kozlowski @ 2007-07-31 22:21 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors, Andrew Morton, James.Bottomley, linux-scsi

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>

 drivers/scsi/zorro7xx.c | 4579 -> 4501 (-78 bytes)

 drivers/scsi/zorro7xx.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

--- linux-2.6.23-rc1-mm1-a/drivers/scsi/zorro7xx.c	2007-07-26 13:07:42.000000000 +0200
+++ linux-2.6.23-rc1-mm1-b/drivers/scsi/zorro7xx.c	2007-07-31 14:25:58.000000000 +0200
@@ -69,7 +69,7 @@ static struct zorro_device_id zorro7xx_z
 static 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(s
 		return -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));

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 82] drivers/scsi/zorro7xx.c: kmalloc + memset conversion to kzalloc
  2007-07-31 22:21 ` [PATCH 82] drivers/scsi/zorro7xx.c: kmalloc + memset conversion to kzalloc Mariusz Kozlowski
@ 2007-08-01 16:11   ` James Bottomley
  0 siblings, 0 replies; 27+ messages in thread
From: James Bottomley @ 2007-08-01 16:11 UTC (permalink / raw)
  To: Mariusz Kozlowski
  Cc: linux-kernel, kernel-janitors, Andrew Morton, linux-scsi

On Wed, 2007-08-01 at 00:21 +0200, Mariusz Kozlowski wrote:
> [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



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 31] drivers/scsi/ide-scsi.c: kmalloc + memset conversion to kzalloc
  2007-07-31 18:01 ` [PATCH 31] drivers/scsi/ide-scsi.c: " Mariusz Kozlowski
@ 2007-08-01 21:02   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 27+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2007-08-01 21:02 UTC (permalink / raw)
  To: Mariusz Kozlowski
  Cc: linux-kernel, kernel-janitors, Andrew Morton, linux-scsi

On Tuesday 31 July 2007, Mariusz Kozlowski wrote:
> Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
> 
>  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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 45] drivers/scsi/lpfc/lpfc_init.c: kmalloc + memset conversion to kcalloc
  2007-07-31 18:26 ` [PATCH 45] drivers/scsi/lpfc/lpfc_init.c: " Mariusz Kozlowski
@ 2007-08-03 15:41   ` James Smart
  0 siblings, 0 replies; 27+ messages in thread
From: James Smart @ 2007-08-03 15:41 UTC (permalink / raw)
  To: Mariusz Kozlowski
  Cc: linux-kernel, kernel-janitors, Andrew Morton, linux-scsi

ACK

-- james s

Mariusz Kozlowski wrote:
> Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
> 
>  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(-)
> 
> --- linux-2.6.23-rc1-mm1-a/drivers/scsi/lpfc/lpfc_init.c	2007-07-26 13:07:42.000000000 +0200
> +++ linux-2.6.23-rc1-mm1-b/drivers/scsi/lpfc/lpfc_init.c	2007-07-31 11:07:59.000000000 +0200
> @@ -1280,11 +1280,10 @@ lpfc_hba_init(struct lpfc_hba *phba, uin
>  	uint32_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;
> 
> 

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 46] drivers/scsi/lpfc/lpfc_scsi.c: kmalloc + memset conversion to kzalloc
  2007-07-31 18:27 ` [PATCH 46] drivers/scsi/lpfc/lpfc_scsi.c: kmalloc + memset conversion to kzalloc Mariusz Kozlowski
@ 2007-08-03 15:41   ` James Smart
  2007-08-03 16:14     ` [PATCH] lpfc : lpfc_debugfs.c " James Smart
                       ` (2 more replies)
  0 siblings, 3 replies; 27+ messages in thread
From: James Smart @ 2007-08-03 15:41 UTC (permalink / raw)
  To: Mariusz Kozlowski
  Cc: linux-kernel, kernel-janitors, Andrew Morton, linux-scsi

ACK

-- james s

Mariusz Kozlowski wrote:
> Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
> 
>  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(-)
> 
> --- linux-2.6.23-rc1-mm1-a/drivers/scsi/lpfc/lpfc_scsi.c	2007-07-26 13:07:42.000000000 +0200
> +++ linux-2.6.23-rc1-mm1-b/drivers/scsi/lpfc/lpfc_scsi.c	2007-07-31 11:08:46.000000000 +0200
> @@ -208,10 +208,9 @@ lpfc_new_scsi_buf(struct lpfc_vport *vpo
>  	dma_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
> 

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 44] drivers/scsi/lpfc/lpfc_debugfs.c: kmalloc + memset conversion to kcalloc
  2007-07-31 18:25 ` [PATCH 44] drivers/scsi/lpfc/lpfc_debugfs.c: kmalloc + memset conversion to kcalloc Mariusz Kozlowski
@ 2007-08-03 15:42   ` James Smart
  0 siblings, 0 replies; 27+ messages in thread
From: James Smart @ 2007-08-03 15:42 UTC (permalink / raw)
  To: Mariusz Kozlowski
  Cc: linux-kernel, kernel-janitors, Andrew Morton, linux-scsi

ACK

-- james s

Mariusz Kozlowski wrote:
> Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
> 
>  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(-)
> 
> --- linux-2.6.23-rc1-mm1-a/drivers/scsi/lpfc/lpfc_debugfs.c	2007-07-26 13:07:42.000000000 +0200
> +++ linux-2.6.23-rc1-mm1-b/drivers/scsi/lpfc/lpfc_debugfs.c	2007-07-31 14:11:24.000000000 +0200
> @@ -432,14 +432,11 @@ lpfc_debugfs_initialize(struct lpfc_vpor
>  	if (!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 =
> 

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH] lpfc : lpfc_debugfs.c kmalloc + memset conversion to kzalloc
  2007-08-03 15:41   ` James Smart
@ 2007-08-03 16:14     ` James Smart
  2007-08-03 16:14     ` James Smart
  2007-08-03 16:15     ` James Smart
  2 siblings, 0 replies; 27+ messages in thread
From: James Smart @ 2007-08-03 16:14 UTC (permalink / raw)
  To: linux-scsi
  Cc: linux-kernel, kernel-janitors, Andrew Morton, Mariusz Kozlowski

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


Signed-off-by: James Smart <James.Smart@emulex.com>


diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index 2e3c01b..ef99e2b 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -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));
 		}
 	}
 



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH] lpfc : lpfc_debugfs.c kmalloc + memset conversion to kzalloc
  2007-08-03 15:41   ` James Smart
  2007-08-03 16:14     ` [PATCH] lpfc : lpfc_debugfs.c " James Smart
@ 2007-08-03 16:14     ` James Smart
  2007-08-03 16:15     ` James Smart
  2 siblings, 0 replies; 27+ messages in thread
From: James Smart @ 2007-08-03 16:14 UTC (permalink / raw)
  To: linux-scsi
  Cc: linux-kernel, kernel-janitors, Andrew Morton, Mariusz Kozlowski

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


Signed-off-by: James Smart <James.Smart@emulex.com>


diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index 2e3c01b..ef99e2b 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -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));
 		}
 	}
 



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH] lpfc : lpfc_debugfs.c kmalloc + memset conversion to kzalloc
  2007-08-03 15:41   ` James Smart
  2007-08-03 16:14     ` [PATCH] lpfc : lpfc_debugfs.c " James Smart
  2007-08-03 16:14     ` James Smart
@ 2007-08-03 16:15     ` James Smart
  2 siblings, 0 replies; 27+ messages in thread
From: James Smart @ 2007-08-03 16:15 UTC (permalink / raw)
  To: linux-scsi
  Cc: linux-kernel, kernel-janitors, Andrew Morton, Mariusz Kozlowski

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


Signed-off-by: James Smart <James.Smart@emulex.com>


diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index 2e3c01b..ef99e2b 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -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));
 		}
 	}
 

^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2007-08-03 16:15 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200707311845.48807.m.kozlowski@tuxland.pl>
2007-07-31 16:50 ` [PATCH 01] kmalloc + memset conversion co kzalloc Mariusz Kozlowski
2007-07-31 16:52 ` [PATCH 02] kmalloc + memset conversion to kzalloc Mariusz Kozlowski
2007-07-31 17:01 ` [PATCH 06] drivers/scsi/bvme6000_scsi.c: " Mariusz Kozlowski
2007-07-31 17:35 ` [PATCH 21] drivers/scsi/dpt_i2o.c: " Mariusz Kozlowski
2007-07-31 17:45   ` Salyzyn, Mark
2007-07-31 17:46 ` [PATCH 26] drivers/scsi/gdth.c: " Mariusz Kozlowski
2007-07-31 18:01 ` [PATCH 31] drivers/scsi/ide-scsi.c: " Mariusz Kozlowski
2007-08-01 21:02   ` Bartlomiej Zolnierkiewicz
2007-07-31 18:25 ` [PATCH 44] drivers/scsi/lpfc/lpfc_debugfs.c: kmalloc + memset conversion to kcalloc Mariusz Kozlowski
2007-08-03 15:42   ` James Smart
2007-07-31 18:26 ` [PATCH 45] drivers/scsi/lpfc/lpfc_init.c: " Mariusz Kozlowski
2007-08-03 15:41   ` James Smart
2007-07-31 18:27 ` [PATCH 46] drivers/scsi/lpfc/lpfc_scsi.c: kmalloc + memset conversion to kzalloc Mariusz Kozlowski
2007-08-03 15:41   ` James Smart
2007-08-03 16:14     ` [PATCH] lpfc : lpfc_debugfs.c " James Smart
2007-08-03 16:14     ` James Smart
2007-08-03 16:15     ` James Smart
2007-07-31 18:34 ` [PATCH 47] drivers/scsi/megaraid.c: " Mariusz Kozlowski
2007-07-31 18:54 ` [PATCH 50] drivers/message/fusion/mptctl.c: mostly " Mariusz Kozlowski
2007-07-31 21:23 ` [PATCH 54] drivers/scsi/mvme16x_scsi.c: " Mariusz Kozlowski
2007-07-31 21:29 ` [PATCH 56] drivers/scsi/NCR_D700.c: " Mariusz Kozlowski
2007-07-31 21:37 ` [PATCH 61] drivers/scsi/osst.c: " Mariusz Kozlowski
2007-07-31 21:46 ` [PATCH 63] drivers/scsi/pluto.c: mostly kmalloc + memset conversion to kcalloc Mariusz Kozlowski
2007-07-31 21:51 ` [PATCH 64] drivers/scsi/qla2xxx/qla_init.c: mostly kmalloc + memset conversion to k[cz]alloc Mariusz Kozlowski
2007-07-31 22:00   ` Andrew Vasquez
2007-07-31 22:21 ` [PATCH 82] drivers/scsi/zorro7xx.c: kmalloc + memset conversion to kzalloc Mariusz Kozlowski
2007-08-01 16:11   ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).