Commit 49d0c6039dd36791cad36624e68bce5fe011bf12
Committed by
Linus Torvalds
1 parent
8ac5436ced
Exists in
master
and in
7 other branches
[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>
Showing 3 changed files with 11 additions and 22 deletions Side-by-side Diff
drivers/fc4/fc.c
... | ... | @@ -266,13 +266,12 @@ |
266 | 266 | printk ("FC: Bad magic from REPORT_AL_MAP on %s - %08x\n", fc->name, p->magic); |
267 | 267 | fc->state = FC_STATE_OFFLINE; |
268 | 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 | 270 | if (!fc->posmap) { |
271 | 271 | printk("FC: Not enough memory, offlining channel\n"); |
272 | 272 | fc->state = FC_STATE_OFFLINE; |
273 | 273 | } else { |
274 | 274 | int k; |
275 | - memset(fc->posmap, 0, sizeof(fcp_posmap)+p->len); | |
276 | 275 | /* FIXME: This is where SOCAL transfers our AL-PA. |
277 | 276 | Keep it here till we found out what other cards do... */ |
278 | 277 | fc->sid = (p->magic & 0xff); |
279 | 278 | |
... | ... | @@ -351,14 +350,12 @@ |
351 | 350 | fc->dma_scsi_rsp = fc->dma_scsi_cmd + slots * sizeof (fcp_cmd); |
352 | 351 | fc->scsi_bitmap_end = (slots + 63) & ~63; |
353 | 352 | size = fc->scsi_bitmap_end / 8; |
354 | - fc->scsi_bitmap = kmalloc (size, GFP_KERNEL); | |
355 | - memset (fc->scsi_bitmap, 0, size); | |
353 | + fc->scsi_bitmap = kzalloc (size, GFP_KERNEL); | |
356 | 354 | set_bit (0, fc->scsi_bitmap); |
357 | 355 | for (i = fc->can_queue; i < fc->scsi_bitmap_end; i++) |
358 | 356 | set_bit (i, fc->scsi_bitmap); |
359 | 357 | fc->scsi_free = fc->can_queue; |
360 | - fc->cmd_slots = (fcp_cmnd **)kmalloc(slots * sizeof(fcp_cmnd*), GFP_KERNEL); | |
361 | - memset(fc->cmd_slots, 0, slots * sizeof(fcp_cmnd*)); | |
358 | + fc->cmd_slots = (fcp_cmnd **)kzalloc(slots * sizeof(fcp_cmnd*), GFP_KERNEL); | |
362 | 359 | fc->abort_count = 0; |
363 | 360 | } else { |
364 | 361 | fc->scsi_name[0] = 0; |
365 | 362 | |
... | ... | @@ -541,12 +538,11 @@ |
541 | 538 | FCND(("fcp_inititialize %08lx\n", (long)fcp_init)) |
542 | 539 | FCND(("fc_channels %08lx\n", (long)fc_channels)) |
543 | 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 | 542 | if (!l) { |
546 | 543 | printk ("FC: Cannot allocate memory for initialization\n"); |
547 | 544 | return -ENOMEM; |
548 | 545 | } |
549 | - memset (l, 0, sizeof(ls) + count); | |
550 | 546 | l->magic = LSMAGIC; |
551 | 547 | l->count = count; |
552 | 548 | FCND(("FCP Init for %d channels\n", count)) |
... | ... | @@ -555,8 +551,8 @@ |
555 | 551 | l->timer.function = fcp_login_timeout; |
556 | 552 | l->timer.data = (unsigned long)l; |
557 | 553 | atomic_set (&l->todo, count); |
558 | - l->logi = kmalloc (count * 3 * sizeof(logi), GFP_KERNEL); | |
559 | - l->fcmds = kmalloc (count * sizeof(fcp_cmnd), GFP_KERNEL); | |
554 | + l->logi = kzalloc (count * 3 * sizeof(logi), GFP_KERNEL); | |
555 | + l->fcmds = kzalloc (count * sizeof(fcp_cmnd), GFP_KERNEL); | |
560 | 556 | if (!l->logi || !l->fcmds) { |
561 | 557 | if (l->logi) kfree (l->logi); |
562 | 558 | if (l->fcmds) kfree (l->fcmds); |
... | ... | @@ -564,8 +560,6 @@ |
564 | 560 | printk ("FC: Cannot allocate DMA memory for initialization\n"); |
565 | 561 | return -ENOMEM; |
566 | 562 | } |
567 | - memset (l->logi, 0, count * 3 * sizeof(logi)); | |
568 | - memset (l->fcmds, 0, count * sizeof(fcp_cmnd)); | |
569 | 563 | for (fc = fcchain, i = 0; fc && i < count; fc = fc->next, i++) { |
570 | 564 | fc->state = FC_STATE_UNINITED; |
571 | 565 | fc->rst_pkt = NULL; /* kmalloc when first used */ |
572 | 566 | |
... | ... | @@ -678,13 +672,12 @@ |
678 | 672 | l.timer.function = fcp_login_timeout; |
679 | 673 | l.timer.data = (unsigned long)&l; |
680 | 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 | 676 | if (!l.fcmds) { |
683 | 677 | kfree (l.fcmds); |
684 | 678 | printk ("FC: Cannot allocate memory for forcing offline\n"); |
685 | 679 | return -ENOMEM; |
686 | 680 | } |
687 | - memset (l.fcmds, 0, count * sizeof(fcp_cmnd)); | |
688 | 681 | FCND(("Initializing OFFLINE packets\n")) |
689 | 682 | for (fc = fcchain, i = 0; fc && i < count; fc = fc->next, i++) { |
690 | 683 | fc->state = FC_STATE_UNINITED; |
691 | 684 | |
... | ... | @@ -1114,9 +1107,8 @@ |
1114 | 1107 | logi *l; |
1115 | 1108 | int status; |
1116 | 1109 | |
1117 | - l = (logi *)kmalloc(2 * sizeof(logi), GFP_KERNEL); | |
1110 | + l = (logi *)kzalloc(2 * sizeof(logi), GFP_KERNEL); | |
1118 | 1111 | if (!l) return -ENOMEM; |
1119 | - memset(l, 0, 2 * sizeof(logi)); | |
1120 | 1112 | l->code = LS_PLOGI; |
1121 | 1113 | memcpy (&l->nport_wwn, &fc->wwn_nport, sizeof(fc_wwn)); |
1122 | 1114 | memcpy (&l->node_wwn, &fc->wwn_node, sizeof(fc_wwn)); |
1123 | 1115 | |
... | ... | @@ -1149,9 +1141,8 @@ |
1149 | 1141 | prli *p; |
1150 | 1142 | int status; |
1151 | 1143 | |
1152 | - p = (prli *)kmalloc(2 * sizeof(prli), GFP_KERNEL); | |
1144 | + p = (prli *)kzalloc(2 * sizeof(prli), GFP_KERNEL); | |
1153 | 1145 | if (!p) return -ENOMEM; |
1154 | - memset(p, 0, 2 * sizeof(prli)); | |
1155 | 1146 | p->code = LS_PRLI; |
1156 | 1147 | p->params[0] = 0x08002000; |
1157 | 1148 | p->params[3] = 0x00000022; |
drivers/fc4/soc.c
... | ... | @@ -556,10 +556,9 @@ |
556 | 556 | int size, i; |
557 | 557 | int irq; |
558 | 558 | |
559 | - s = kmalloc (sizeof (struct soc), GFP_KERNEL); | |
559 | + s = kzalloc (sizeof (struct soc), GFP_KERNEL); | |
560 | 560 | if (s == NULL) |
561 | 561 | return; |
562 | - memset (s, 0, sizeof(struct soc)); | |
563 | 562 | spin_lock_init(&s->lock); |
564 | 563 | s->soc_no = no; |
565 | 564 |
drivers/fc4/socal.c
... | ... | @@ -665,9 +665,8 @@ |
665 | 665 | int size, i; |
666 | 666 | int irq, node; |
667 | 667 | |
668 | - s = kmalloc (sizeof (struct socal), GFP_KERNEL); | |
668 | + s = kzalloc (sizeof (struct socal), GFP_KERNEL); | |
669 | 669 | if (!s) return; |
670 | - memset (s, 0, sizeof(struct socal)); | |
671 | 670 | spin_lock_init(&s->lock); |
672 | 671 | s->socal_no = no; |
673 | 672 |