aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepak Saxena <dsaxena@plexity.net>2005-11-07 04:01:24 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 10:53:59 -0500
commit49d0c6039dd36791cad36624e68bce5fe011bf12 (patch)
tree1d116c902e5950fdb36f97691fdce421850bb91a
parent8ac5436ced2fd4eab3abe7cbc6d5a29881fa9ccb (diff)
[PATCH] drivers/fc4: kmalloc + memset -> kzalloc conversion
Signed-off-by: Deepak Saxena <dsaxena@plexity.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/fc4/fc.c27
-rw-r--r--drivers/fc4/soc.c3
-rw-r--r--drivers/fc4/socal.c3
3 files changed, 11 insertions, 22 deletions
diff --git a/drivers/fc4/fc.c b/drivers/fc4/fc.c
index e4710d1d1f9d..e375995a2e9b 100644
--- a/drivers/fc4/fc.c
+++ b/drivers/fc4/fc.c
@@ -266,13 +266,12 @@ static void fcp_report_map_done(fc_channel *fc, int i, int status)
266 printk ("FC: Bad magic from REPORT_AL_MAP on %s - %08x\n", fc->name, p->magic); 266 printk ("FC: Bad magic from REPORT_AL_MAP on %s - %08x\n", fc->name, p->magic);
267 fc->state = FC_STATE_OFFLINE; 267 fc->state = FC_STATE_OFFLINE;
268 } else { 268 } else {
269 fc->posmap = (fcp_posmap *)kmalloc(sizeof(fcp_posmap)+p->len, GFP_KERNEL); 269 fc->posmap = (fcp_posmap *)kzalloc(sizeof(fcp_posmap)+p->len, GFP_KERNEL);
270 if (!fc->posmap) { 270 if (!fc->posmap) {
271 printk("FC: Not enough memory, offlining channel\n"); 271 printk("FC: Not enough memory, offlining channel\n");
272 fc->state = FC_STATE_OFFLINE; 272 fc->state = FC_STATE_OFFLINE;
273 } else { 273 } else {
274 int k; 274 int k;
275 memset(fc->posmap, 0, sizeof(fcp_posmap)+p->len);
276 /* FIXME: This is where SOCAL transfers our AL-PA. 275 /* FIXME: This is where SOCAL transfers our AL-PA.
277 Keep it here till we found out what other cards do... */ 276 Keep it here till we found out what other cards do... */
278 fc->sid = (p->magic & 0xff); 277 fc->sid = (p->magic & 0xff);
@@ -351,14 +350,12 @@ void fcp_register(fc_channel *fc, u8 type, int unregister)
351 fc->dma_scsi_rsp = fc->dma_scsi_cmd + slots * sizeof (fcp_cmd); 350 fc->dma_scsi_rsp = fc->dma_scsi_cmd + slots * sizeof (fcp_cmd);
352 fc->scsi_bitmap_end = (slots + 63) & ~63; 351 fc->scsi_bitmap_end = (slots + 63) & ~63;
353 size = fc->scsi_bitmap_end / 8; 352 size = fc->scsi_bitmap_end / 8;
354 fc->scsi_bitmap = kmalloc (size, GFP_KERNEL); 353 fc->scsi_bitmap = kzalloc (size, GFP_KERNEL);
355 memset (fc->scsi_bitmap, 0, size);
356 set_bit (0, fc->scsi_bitmap); 354 set_bit (0, fc->scsi_bitmap);
357 for (i = fc->can_queue; i < fc->scsi_bitmap_end; i++) 355 for (i = fc->can_queue; i < fc->scsi_bitmap_end; i++)
358 set_bit (i, fc->scsi_bitmap); 356 set_bit (i, fc->scsi_bitmap);
359 fc->scsi_free = fc->can_queue; 357 fc->scsi_free = fc->can_queue;
360 fc->cmd_slots = (fcp_cmnd **)kmalloc(slots * sizeof(fcp_cmnd*), GFP_KERNEL); 358 fc->cmd_slots = (fcp_cmnd **)kzalloc(slots * sizeof(fcp_cmnd*), GFP_KERNEL);
361 memset(fc->cmd_slots, 0, slots * sizeof(fcp_cmnd*));
362 fc->abort_count = 0; 359 fc->abort_count = 0;
363 } else { 360 } else {
364 fc->scsi_name[0] = 0; 361 fc->scsi_name[0] = 0;
@@ -541,12 +538,11 @@ int fcp_initialize(fc_channel *fcchain, int count)
541 FCND(("fcp_inititialize %08lx\n", (long)fcp_init)) 538 FCND(("fcp_inititialize %08lx\n", (long)fcp_init))
542 FCND(("fc_channels %08lx\n", (long)fc_channels)) 539 FCND(("fc_channels %08lx\n", (long)fc_channels))
543 FCND((" SID %d DID %d\n", fcchain->sid, fcchain->did)) 540 FCND((" SID %d DID %d\n", fcchain->sid, fcchain->did))
544 l = kmalloc(sizeof (ls) + count, GFP_KERNEL); 541 l = kzalloc(sizeof (ls) + count, GFP_KERNEL);
545 if (!l) { 542 if (!l) {
546 printk ("FC: Cannot allocate memory for initialization\n"); 543 printk ("FC: Cannot allocate memory for initialization\n");
547 return -ENOMEM; 544 return -ENOMEM;
548 } 545 }
549 memset (l, 0, sizeof(ls) + count);
550 l->magic = LSMAGIC; 546 l->magic = LSMAGIC;
551 l->count = count; 547 l->count = count;
552 FCND(("FCP Init for %d channels\n", count)) 548 FCND(("FCP Init for %d channels\n", count))
@@ -555,8 +551,8 @@ int fcp_initialize(fc_channel *fcchain, int count)
555 l->timer.function = fcp_login_timeout; 551 l->timer.function = fcp_login_timeout;
556 l->timer.data = (unsigned long)l; 552 l->timer.data = (unsigned long)l;
557 atomic_set (&l->todo, count); 553 atomic_set (&l->todo, count);
558 l->logi = kmalloc (count * 3 * sizeof(logi), GFP_KERNEL); 554 l->logi = kzalloc (count * 3 * sizeof(logi), GFP_KERNEL);
559 l->fcmds = kmalloc (count * sizeof(fcp_cmnd), GFP_KERNEL); 555 l->fcmds = kzalloc (count * sizeof(fcp_cmnd), GFP_KERNEL);
560 if (!l->logi || !l->fcmds) { 556 if (!l->logi || !l->fcmds) {
561 if (l->logi) kfree (l->logi); 557 if (l->logi) kfree (l->logi);
562 if (l->fcmds) kfree (l->fcmds); 558 if (l->fcmds) kfree (l->fcmds);
@@ -564,8 +560,6 @@ int fcp_initialize(fc_channel *fcchain, int count)
564 printk ("FC: Cannot allocate DMA memory for initialization\n"); 560 printk ("FC: Cannot allocate DMA memory for initialization\n");
565 return -ENOMEM; 561 return -ENOMEM;
566 } 562 }
567 memset (l->logi, 0, count * 3 * sizeof(logi));
568 memset (l->fcmds, 0, count * sizeof(fcp_cmnd));
569 for (fc = fcchain, i = 0; fc && i < count; fc = fc->next, i++) { 563 for (fc = fcchain, i = 0; fc && i < count; fc = fc->next, i++) {
570 fc->state = FC_STATE_UNINITED; 564 fc->state = FC_STATE_UNINITED;
571 fc->rst_pkt = NULL; /* kmalloc when first used */ 565 fc->rst_pkt = NULL; /* kmalloc when first used */
@@ -678,13 +672,12 @@ int fcp_forceoffline(fc_channel *fcchain, int count)
678 l.timer.function = fcp_login_timeout; 672 l.timer.function = fcp_login_timeout;
679 l.timer.data = (unsigned long)&l; 673 l.timer.data = (unsigned long)&l;
680 atomic_set (&l.todo, count); 674 atomic_set (&l.todo, count);
681 l.fcmds = kmalloc (count * sizeof(fcp_cmnd), GFP_KERNEL); 675 l.fcmds = kzalloc (count * sizeof(fcp_cmnd), GFP_KERNEL);
682 if (!l.fcmds) { 676 if (!l.fcmds) {
683 kfree (l.fcmds); 677 kfree (l.fcmds);
684 printk ("FC: Cannot allocate memory for forcing offline\n"); 678 printk ("FC: Cannot allocate memory for forcing offline\n");
685 return -ENOMEM; 679 return -ENOMEM;
686 } 680 }
687 memset (l.fcmds, 0, count * sizeof(fcp_cmnd));
688 FCND(("Initializing OFFLINE packets\n")) 681 FCND(("Initializing OFFLINE packets\n"))
689 for (fc = fcchain, i = 0; fc && i < count; fc = fc->next, i++) { 682 for (fc = fcchain, i = 0; fc && i < count; fc = fc->next, i++) {
690 fc->state = FC_STATE_UNINITED; 683 fc->state = FC_STATE_UNINITED;
@@ -1114,9 +1107,8 @@ int fc_do_plogi(fc_channel *fc, unsigned char alpa, fc_wwn *node, fc_wwn *nport)
1114 logi *l; 1107 logi *l;
1115 int status; 1108 int status;
1116 1109
1117 l = (logi *)kmalloc(2 * sizeof(logi), GFP_KERNEL); 1110 l = (logi *)kzalloc(2 * sizeof(logi), GFP_KERNEL);
1118 if (!l) return -ENOMEM; 1111 if (!l) return -ENOMEM;
1119 memset(l, 0, 2 * sizeof(logi));
1120 l->code = LS_PLOGI; 1112 l->code = LS_PLOGI;
1121 memcpy (&l->nport_wwn, &fc->wwn_nport, sizeof(fc_wwn)); 1113 memcpy (&l->nport_wwn, &fc->wwn_nport, sizeof(fc_wwn));
1122 memcpy (&l->node_wwn, &fc->wwn_node, sizeof(fc_wwn)); 1114 memcpy (&l->node_wwn, &fc->wwn_node, sizeof(fc_wwn));
@@ -1149,9 +1141,8 @@ int fc_do_prli(fc_channel *fc, unsigned char alpa)
1149 prli *p; 1141 prli *p;
1150 int status; 1142 int status;
1151 1143
1152 p = (prli *)kmalloc(2 * sizeof(prli), GFP_KERNEL); 1144 p = (prli *)kzalloc(2 * sizeof(prli), GFP_KERNEL);
1153 if (!p) return -ENOMEM; 1145 if (!p) return -ENOMEM;
1154 memset(p, 0, 2 * sizeof(prli));
1155 p->code = LS_PRLI; 1146 p->code = LS_PRLI;
1156 p->params[0] = 0x08002000; 1147 p->params[0] = 0x08002000;
1157 p->params[3] = 0x00000022; 1148 p->params[3] = 0x00000022;
diff --git a/drivers/fc4/soc.c b/drivers/fc4/soc.c
index 247b46302777..ec1f94738c59 100644
--- a/drivers/fc4/soc.c
+++ b/drivers/fc4/soc.c
@@ -556,10 +556,9 @@ static inline void soc_init(struct sbus_dev *sdev, int no)
556 int size, i; 556 int size, i;
557 int irq; 557 int irq;
558 558
559 s = kmalloc (sizeof (struct soc), GFP_KERNEL); 559 s = kzalloc (sizeof (struct soc), GFP_KERNEL);
560 if (s == NULL) 560 if (s == NULL)
561 return; 561 return;
562 memset (s, 0, sizeof(struct soc));
563 spin_lock_init(&s->lock); 562 spin_lock_init(&s->lock);
564 s->soc_no = no; 563 s->soc_no = no;
565 564
diff --git a/drivers/fc4/socal.c b/drivers/fc4/socal.c
index b2377dbd84a1..922e9613b2cf 100644
--- a/drivers/fc4/socal.c
+++ b/drivers/fc4/socal.c
@@ -665,9 +665,8 @@ static inline void socal_init(struct sbus_dev *sdev, int no)
665 int size, i; 665 int size, i;
666 int irq, node; 666 int irq, node;
667 667
668 s = kmalloc (sizeof (struct socal), GFP_KERNEL); 668 s = kzalloc (sizeof (struct socal), GFP_KERNEL);
669 if (!s) return; 669 if (!s) return;
670 memset (s, 0, sizeof(struct socal));
671 spin_lock_init(&s->lock); 670 spin_lock_init(&s->lock);
672 s->socal_no = no; 671 s->socal_no = no;
673 672