aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/net/qeth_eddp.c
diff options
context:
space:
mode:
authorEric Sesterhenn <snakebyte@gmx.de>2006-03-24 06:15:31 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-24 10:33:18 -0500
commit88abaab4f9b08381e30e737980a1c49d6b524dfc (patch)
treed33aa82674c00c37cd293c9e888cff785880ce5a /drivers/s390/net/qeth_eddp.c
parentfb630517f0d0736ea73af07d6b357be9ad67e6f1 (diff)
[PATCH] s390: kzalloc() conversion in drivers/s390
Convert all kmalloc + memset sequences in drivers/s390 to kzalloc usage. Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/s390/net/qeth_eddp.c')
-rw-r--r--drivers/s390/net/qeth_eddp.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/s390/net/qeth_eddp.c b/drivers/s390/net/qeth_eddp.c
index 82cb4af2f0e7..44e226f211e7 100644
--- a/drivers/s390/net/qeth_eddp.c
+++ b/drivers/s390/net/qeth_eddp.c
@@ -389,9 +389,8 @@ qeth_eddp_create_eddp_data(struct qeth_hdr *qh, u8 *nh, u8 nhl, u8 *th, u8 thl)
389 struct qeth_eddp_data *eddp; 389 struct qeth_eddp_data *eddp;
390 390
391 QETH_DBF_TEXT(trace, 5, "eddpcrda"); 391 QETH_DBF_TEXT(trace, 5, "eddpcrda");
392 eddp = kmalloc(sizeof(struct qeth_eddp_data), GFP_ATOMIC); 392 eddp = kzalloc(sizeof(struct qeth_eddp_data), GFP_ATOMIC);
393 if (eddp){ 393 if (eddp){
394 memset(eddp, 0, sizeof(struct qeth_eddp_data));
395 eddp->nhl = nhl; 394 eddp->nhl = nhl;
396 eddp->thl = thl; 395 eddp->thl = thl;
397 memcpy(&eddp->qh, qh, sizeof(struct qeth_hdr)); 396 memcpy(&eddp->qh, qh, sizeof(struct qeth_hdr));
@@ -542,12 +541,11 @@ qeth_eddp_create_context_generic(struct qeth_card *card, struct sk_buff *skb,
542 541
543 QETH_DBF_TEXT(trace, 5, "creddpcg"); 542 QETH_DBF_TEXT(trace, 5, "creddpcg");
544 /* create the context and allocate pages */ 543 /* create the context and allocate pages */
545 ctx = kmalloc(sizeof(struct qeth_eddp_context), GFP_ATOMIC); 544 ctx = kzalloc(sizeof(struct qeth_eddp_context), GFP_ATOMIC);
546 if (ctx == NULL){ 545 if (ctx == NULL){
547 QETH_DBF_TEXT(trace, 2, "ceddpcn1"); 546 QETH_DBF_TEXT(trace, 2, "ceddpcn1");
548 return NULL; 547 return NULL;
549 } 548 }
550 memset(ctx, 0, sizeof(struct qeth_eddp_context));
551 ctx->type = QETH_LARGE_SEND_EDDP; 549 ctx->type = QETH_LARGE_SEND_EDDP;
552 qeth_eddp_calc_num_pages(ctx, skb, hdr_len); 550 qeth_eddp_calc_num_pages(ctx, skb, hdr_len);
553 if (ctx->elements_per_skb > QETH_MAX_BUFFER_ELEMENTS(card)){ 551 if (ctx->elements_per_skb > QETH_MAX_BUFFER_ELEMENTS(card)){
@@ -555,13 +553,12 @@ qeth_eddp_create_context_generic(struct qeth_card *card, struct sk_buff *skb,
555 kfree(ctx); 553 kfree(ctx);
556 return NULL; 554 return NULL;
557 } 555 }
558 ctx->pages = kmalloc(ctx->num_pages * sizeof(u8 *), GFP_ATOMIC); 556 ctx->pages = kcalloc(ctx->num_pages, sizeof(u8 *), GFP_ATOMIC);
559 if (ctx->pages == NULL){ 557 if (ctx->pages == NULL){
560 QETH_DBF_TEXT(trace, 2, "ceddpcn2"); 558 QETH_DBF_TEXT(trace, 2, "ceddpcn2");
561 kfree(ctx); 559 kfree(ctx);
562 return NULL; 560 return NULL;
563 } 561 }
564 memset(ctx->pages, 0, ctx->num_pages * sizeof(u8 *));
565 for (i = 0; i < ctx->num_pages; ++i){ 562 for (i = 0; i < ctx->num_pages; ++i){
566 addr = (u8 *)__get_free_page(GFP_ATOMIC); 563 addr = (u8 *)__get_free_page(GFP_ATOMIC);
567 if (addr == NULL){ 564 if (addr == NULL){
@@ -573,15 +570,13 @@ qeth_eddp_create_context_generic(struct qeth_card *card, struct sk_buff *skb,
573 memset(addr, 0, PAGE_SIZE); 570 memset(addr, 0, PAGE_SIZE);
574 ctx->pages[i] = addr; 571 ctx->pages[i] = addr;
575 } 572 }
576 ctx->elements = kmalloc(ctx->num_elements * 573 ctx->elements = kcalloc(ctx->num_elements,
577 sizeof(struct qeth_eddp_element), GFP_ATOMIC); 574 sizeof(struct qeth_eddp_element), GFP_ATOMIC);
578 if (ctx->elements == NULL){ 575 if (ctx->elements == NULL){
579 QETH_DBF_TEXT(trace, 2, "ceddpcn4"); 576 QETH_DBF_TEXT(trace, 2, "ceddpcn4");
580 qeth_eddp_free_context(ctx); 577 qeth_eddp_free_context(ctx);
581 return NULL; 578 return NULL;
582 } 579 }
583 memset(ctx->elements, 0,
584 ctx->num_elements * sizeof(struct qeth_eddp_element));
585 /* reset num_elements; will be incremented again in fill_buffer to 580 /* reset num_elements; will be incremented again in fill_buffer to
586 * reflect number of actually used elements */ 581 * reflect number of actually used elements */
587 ctx->num_elements = 0; 582 ctx->num_elements = 0;