diff options
author | Eric Sesterhenn <snakebyte@gmx.de> | 2006-03-24 06:15:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-24 10:33:18 -0500 |
commit | 88abaab4f9b08381e30e737980a1c49d6b524dfc (patch) | |
tree | d33aa82674c00c37cd293c9e888cff785880ce5a /drivers | |
parent | fb630517f0d0736ea73af07d6b357be9ad67e6f1 (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')
-rw-r--r-- | drivers/s390/block/dasd.c | 12 | ||||
-rw-r--r-- | drivers/s390/block/dcssblk.c | 3 | ||||
-rw-r--r-- | drivers/s390/char/fs3270.c | 3 | ||||
-rw-r--r-- | drivers/s390/char/keyboard.c | 12 | ||||
-rw-r--r-- | drivers/s390/char/monreader.c | 6 | ||||
-rw-r--r-- | drivers/s390/char/raw3270.c | 3 | ||||
-rw-r--r-- | drivers/s390/char/tape_class.c | 3 | ||||
-rw-r--r-- | drivers/s390/char/tape_core.c | 16 | ||||
-rw-r--r-- | drivers/s390/char/tty3270.c | 9 | ||||
-rw-r--r-- | drivers/s390/char/vmlogrdr.c | 3 | ||||
-rw-r--r-- | drivers/s390/cio/ccwgroup.c | 3 | ||||
-rw-r--r-- | drivers/s390/cio/chsc.c | 3 | ||||
-rw-r--r-- | drivers/s390/cio/css.c | 3 | ||||
-rw-r--r-- | drivers/s390/cio/device.c | 6 | ||||
-rw-r--r-- | drivers/s390/cio/device_ops.c | 9 | ||||
-rw-r--r-- | drivers/s390/cio/qdio.c | 20 | ||||
-rw-r--r-- | drivers/s390/crypto/z90main.c | 10 | ||||
-rw-r--r-- | drivers/s390/net/claw.c | 3 | ||||
-rw-r--r-- | drivers/s390/net/fsm.c | 10 | ||||
-rw-r--r-- | drivers/s390/net/iucv.c | 11 | ||||
-rw-r--r-- | drivers/s390/net/lcs.c | 11 | ||||
-rw-r--r-- | drivers/s390/net/netiucv.c | 7 | ||||
-rw-r--r-- | drivers/s390/net/qeth_eddp.c | 13 | ||||
-rw-r--r-- | drivers/s390/net/qeth_main.c | 20 | ||||
-rw-r--r-- | drivers/s390/net/qeth_sys.c | 3 | ||||
-rw-r--r-- | drivers/s390/s390_rdev.c | 3 |
26 files changed, 67 insertions, 138 deletions
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index f32f7447588b..dfe542b206cc 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -71,10 +71,9 @@ dasd_alloc_device(void) | |||
71 | { | 71 | { |
72 | struct dasd_device *device; | 72 | struct dasd_device *device; |
73 | 73 | ||
74 | device = kmalloc(sizeof (struct dasd_device), GFP_ATOMIC); | 74 | device = kzalloc(sizeof (struct dasd_device), GFP_ATOMIC); |
75 | if (device == NULL) | 75 | if (device == NULL) |
76 | return ERR_PTR(-ENOMEM); | 76 | return ERR_PTR(-ENOMEM); |
77 | memset(device, 0, sizeof (struct dasd_device)); | ||
78 | /* open_count = 0 means device online but not in use */ | 77 | /* open_count = 0 means device online but not in use */ |
79 | atomic_set(&device->open_count, -1); | 78 | atomic_set(&device->open_count, -1); |
80 | 79 | ||
@@ -547,29 +546,26 @@ dasd_kmalloc_request(char *magic, int cplength, int datasize, | |||
547 | (cplength*sizeof(struct ccw1)) > PAGE_SIZE) | 546 | (cplength*sizeof(struct ccw1)) > PAGE_SIZE) |
548 | BUG(); | 547 | BUG(); |
549 | 548 | ||
550 | cqr = kmalloc(sizeof(struct dasd_ccw_req), GFP_ATOMIC); | 549 | cqr = kzalloc(sizeof(struct dasd_ccw_req), GFP_ATOMIC); |
551 | if (cqr == NULL) | 550 | if (cqr == NULL) |
552 | return ERR_PTR(-ENOMEM); | 551 | return ERR_PTR(-ENOMEM); |
553 | memset(cqr, 0, sizeof(struct dasd_ccw_req)); | ||
554 | cqr->cpaddr = NULL; | 552 | cqr->cpaddr = NULL; |
555 | if (cplength > 0) { | 553 | if (cplength > 0) { |
556 | cqr->cpaddr = kmalloc(cplength*sizeof(struct ccw1), | 554 | cqr->cpaddr = kcalloc(cplength, sizeof(struct ccw1), |
557 | GFP_ATOMIC | GFP_DMA); | 555 | GFP_ATOMIC | GFP_DMA); |
558 | if (cqr->cpaddr == NULL) { | 556 | if (cqr->cpaddr == NULL) { |
559 | kfree(cqr); | 557 | kfree(cqr); |
560 | return ERR_PTR(-ENOMEM); | 558 | return ERR_PTR(-ENOMEM); |
561 | } | 559 | } |
562 | memset(cqr->cpaddr, 0, cplength*sizeof(struct ccw1)); | ||
563 | } | 560 | } |
564 | cqr->data = NULL; | 561 | cqr->data = NULL; |
565 | if (datasize > 0) { | 562 | if (datasize > 0) { |
566 | cqr->data = kmalloc(datasize, GFP_ATOMIC | GFP_DMA); | 563 | cqr->data = kzalloc(datasize, GFP_ATOMIC | GFP_DMA); |
567 | if (cqr->data == NULL) { | 564 | if (cqr->data == NULL) { |
568 | kfree(cqr->cpaddr); | 565 | kfree(cqr->cpaddr); |
569 | kfree(cqr); | 566 | kfree(cqr); |
570 | return ERR_PTR(-ENOMEM); | 567 | return ERR_PTR(-ENOMEM); |
571 | } | 568 | } |
572 | memset(cqr->data, 0, datasize); | ||
573 | } | 569 | } |
574 | strncpy((char *) &cqr->magic, magic, 4); | 570 | strncpy((char *) &cqr->magic, magic, 4); |
575 | ASCEBC((char *) &cqr->magic, 4); | 571 | ASCEBC((char *) &cqr->magic, 4); |
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index 44133250da2e..be9b05347b4f 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c | |||
@@ -388,12 +388,11 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char | |||
388 | /* | 388 | /* |
389 | * get a struct dcssblk_dev_info | 389 | * get a struct dcssblk_dev_info |
390 | */ | 390 | */ |
391 | dev_info = kmalloc(sizeof(struct dcssblk_dev_info), GFP_KERNEL); | 391 | dev_info = kzalloc(sizeof(struct dcssblk_dev_info), GFP_KERNEL); |
392 | if (dev_info == NULL) { | 392 | if (dev_info == NULL) { |
393 | rc = -ENOMEM; | 393 | rc = -ENOMEM; |
394 | goto out; | 394 | goto out; |
395 | } | 395 | } |
396 | memset(dev_info, 0, sizeof(struct dcssblk_dev_info)); | ||
397 | 396 | ||
398 | strcpy(dev_info->segment_name, local_buf); | 397 | strcpy(dev_info->segment_name, local_buf); |
399 | strlcpy(dev_info->dev.bus_id, local_buf, BUS_ID_SIZE); | 398 | strlcpy(dev_info->dev.bus_id, local_buf, BUS_ID_SIZE); |
diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c index 5f6fa4c67843..a6415377bc73 100644 --- a/drivers/s390/char/fs3270.c +++ b/drivers/s390/char/fs3270.c | |||
@@ -368,10 +368,9 @@ fs3270_alloc_view(void) | |||
368 | { | 368 | { |
369 | struct fs3270 *fp; | 369 | struct fs3270 *fp; |
370 | 370 | ||
371 | fp = (struct fs3270 *) kmalloc(sizeof(struct fs3270),GFP_KERNEL); | 371 | fp = kzalloc(sizeof(struct fs3270),GFP_KERNEL); |
372 | if (!fp) | 372 | if (!fp) |
373 | return ERR_PTR(-ENOMEM); | 373 | return ERR_PTR(-ENOMEM); |
374 | memset(fp, 0, sizeof(struct fs3270)); | ||
375 | fp->init = raw3270_request_alloc(0); | 374 | fp->init = raw3270_request_alloc(0); |
376 | if (IS_ERR(fp->init)) { | 375 | if (IS_ERR(fp->init)) { |
377 | kfree(fp); | 376 | kfree(fp); |
diff --git a/drivers/s390/char/keyboard.c b/drivers/s390/char/keyboard.c index a317a123daba..6badd8403409 100644 --- a/drivers/s390/char/keyboard.c +++ b/drivers/s390/char/keyboard.c | |||
@@ -50,14 +50,12 @@ kbd_alloc(void) { | |||
50 | struct kbd_data *kbd; | 50 | struct kbd_data *kbd; |
51 | int i, len; | 51 | int i, len; |
52 | 52 | ||
53 | kbd = kmalloc(sizeof(struct kbd_data), GFP_KERNEL); | 53 | kbd = kzalloc(sizeof(struct kbd_data), GFP_KERNEL); |
54 | if (!kbd) | 54 | if (!kbd) |
55 | goto out; | 55 | goto out; |
56 | memset(kbd, 0, sizeof(struct kbd_data)); | 56 | kbd->key_maps = kzalloc(sizeof(key_maps), GFP_KERNEL); |
57 | kbd->key_maps = kmalloc(sizeof(key_maps), GFP_KERNEL); | ||
58 | if (!key_maps) | 57 | if (!key_maps) |
59 | goto out_kbd; | 58 | goto out_kbd; |
60 | memset(kbd->key_maps, 0, sizeof(key_maps)); | ||
61 | for (i = 0; i < ARRAY_SIZE(key_maps); i++) { | 59 | for (i = 0; i < ARRAY_SIZE(key_maps); i++) { |
62 | if (key_maps[i]) { | 60 | if (key_maps[i]) { |
63 | kbd->key_maps[i] = | 61 | kbd->key_maps[i] = |
@@ -68,10 +66,9 @@ kbd_alloc(void) { | |||
68 | sizeof(u_short)*NR_KEYS); | 66 | sizeof(u_short)*NR_KEYS); |
69 | } | 67 | } |
70 | } | 68 | } |
71 | kbd->func_table = kmalloc(sizeof(func_table), GFP_KERNEL); | 69 | kbd->func_table = kzalloc(sizeof(func_table), GFP_KERNEL); |
72 | if (!kbd->func_table) | 70 | if (!kbd->func_table) |
73 | goto out_maps; | 71 | goto out_maps; |
74 | memset(kbd->func_table, 0, sizeof(func_table)); | ||
75 | for (i = 0; i < ARRAY_SIZE(func_table); i++) { | 72 | for (i = 0; i < ARRAY_SIZE(func_table); i++) { |
76 | if (func_table[i]) { | 73 | if (func_table[i]) { |
77 | len = strlen(func_table[i]) + 1; | 74 | len = strlen(func_table[i]) + 1; |
@@ -82,10 +79,9 @@ kbd_alloc(void) { | |||
82 | } | 79 | } |
83 | } | 80 | } |
84 | kbd->fn_handler = | 81 | kbd->fn_handler = |
85 | kmalloc(sizeof(fn_handler_fn *) * NR_FN_HANDLER, GFP_KERNEL); | 82 | kzalloc(sizeof(fn_handler_fn *) * NR_FN_HANDLER, GFP_KERNEL); |
86 | if (!kbd->fn_handler) | 83 | if (!kbd->fn_handler) |
87 | goto out_func; | 84 | goto out_func; |
88 | memset(kbd->fn_handler, 0, sizeof(fn_handler_fn *) * NR_FN_HANDLER); | ||
89 | kbd->accent_table = | 85 | kbd->accent_table = |
90 | kmalloc(sizeof(struct kbdiacr)*MAX_DIACR, GFP_KERNEL); | 86 | kmalloc(sizeof(struct kbdiacr)*MAX_DIACR, GFP_KERNEL); |
91 | if (!kbd->accent_table) | 87 | if (!kbd->accent_table) |
diff --git a/drivers/s390/char/monreader.c b/drivers/s390/char/monreader.c index 5fd3ad867386..fb7bc9e5eebc 100644 --- a/drivers/s390/char/monreader.c +++ b/drivers/s390/char/monreader.c | |||
@@ -257,14 +257,13 @@ mon_alloc_mem(void) | |||
257 | int i,j; | 257 | int i,j; |
258 | struct mon_private *monpriv; | 258 | struct mon_private *monpriv; |
259 | 259 | ||
260 | monpriv = kmalloc(sizeof(struct mon_private), GFP_KERNEL); | 260 | monpriv = kzalloc(sizeof(struct mon_private), GFP_KERNEL); |
261 | if (!monpriv) { | 261 | if (!monpriv) { |
262 | P_ERROR("no memory for monpriv\n"); | 262 | P_ERROR("no memory for monpriv\n"); |
263 | return NULL; | 263 | return NULL; |
264 | } | 264 | } |
265 | memset(monpriv, 0, sizeof(struct mon_private)); | ||
266 | for (i = 0; i < MON_MSGLIM; i++) { | 265 | for (i = 0; i < MON_MSGLIM; i++) { |
267 | monpriv->msg_array[i] = kmalloc(sizeof(struct mon_msg), | 266 | monpriv->msg_array[i] = kzalloc(sizeof(struct mon_msg), |
268 | GFP_KERNEL); | 267 | GFP_KERNEL); |
269 | if (!monpriv->msg_array[i]) { | 268 | if (!monpriv->msg_array[i]) { |
270 | P_ERROR("open, no memory for msg_array\n"); | 269 | P_ERROR("open, no memory for msg_array\n"); |
@@ -272,7 +271,6 @@ mon_alloc_mem(void) | |||
272 | kfree(monpriv->msg_array[j]); | 271 | kfree(monpriv->msg_array[j]); |
273 | return NULL; | 272 | return NULL; |
274 | } | 273 | } |
275 | memset(monpriv->msg_array[i], 0, sizeof(struct mon_msg)); | ||
276 | } | 274 | } |
277 | return monpriv; | 275 | return monpriv; |
278 | } | 276 | } |
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c index 1026f2bc3185..bd06607a5dcc 100644 --- a/drivers/s390/char/raw3270.c +++ b/drivers/s390/char/raw3270.c | |||
@@ -115,10 +115,9 @@ raw3270_request_alloc(size_t size) | |||
115 | struct raw3270_request *rq; | 115 | struct raw3270_request *rq; |
116 | 116 | ||
117 | /* Allocate request structure */ | 117 | /* Allocate request structure */ |
118 | rq = kmalloc(sizeof(struct raw3270_request), GFP_KERNEL | GFP_DMA); | 118 | rq = kzalloc(sizeof(struct raw3270_request), GFP_KERNEL | GFP_DMA); |
119 | if (!rq) | 119 | if (!rq) |
120 | return ERR_PTR(-ENOMEM); | 120 | return ERR_PTR(-ENOMEM); |
121 | memset(rq, 0, sizeof(struct raw3270_request)); | ||
122 | 121 | ||
123 | /* alloc output buffer. */ | 122 | /* alloc output buffer. */ |
124 | if (size > 0) { | 123 | if (size > 0) { |
diff --git a/drivers/s390/char/tape_class.c b/drivers/s390/char/tape_class.c index b3569c82bb16..a5c68e60fcf4 100644 --- a/drivers/s390/char/tape_class.c +++ b/drivers/s390/char/tape_class.c | |||
@@ -44,11 +44,10 @@ struct tape_class_device *register_tape_dev( | |||
44 | int rc; | 44 | int rc; |
45 | char * s; | 45 | char * s; |
46 | 46 | ||
47 | tcd = kmalloc(sizeof(struct tape_class_device), GFP_KERNEL); | 47 | tcd = kzalloc(sizeof(struct tape_class_device), GFP_KERNEL); |
48 | if (!tcd) | 48 | if (!tcd) |
49 | return ERR_PTR(-ENOMEM); | 49 | return ERR_PTR(-ENOMEM); |
50 | 50 | ||
51 | memset(tcd, 0, sizeof(struct tape_class_device)); | ||
52 | strncpy(tcd->device_name, device_name, TAPECLASS_NAME_LEN); | 51 | strncpy(tcd->device_name, device_name, TAPECLASS_NAME_LEN); |
53 | for (s = strchr(tcd->device_name, '/'); s; s = strchr(s, '/')) | 52 | for (s = strchr(tcd->device_name, '/'); s; s = strchr(s, '/')) |
54 | *s = '!'; | 53 | *s = '!'; |
diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c index c6fab5dbdd44..389ee2c0f443 100644 --- a/drivers/s390/char/tape_core.c +++ b/drivers/s390/char/tape_core.c | |||
@@ -453,16 +453,14 @@ tape_alloc_device(void) | |||
453 | { | 453 | { |
454 | struct tape_device *device; | 454 | struct tape_device *device; |
455 | 455 | ||
456 | device = (struct tape_device *) | 456 | device = kzalloc(sizeof(struct tape_device), GFP_KERNEL); |
457 | kmalloc(sizeof(struct tape_device), GFP_KERNEL); | ||
458 | if (device == NULL) { | 457 | if (device == NULL) { |
459 | DBF_EXCEPTION(2, "ti:no mem\n"); | 458 | DBF_EXCEPTION(2, "ti:no mem\n"); |
460 | PRINT_INFO ("can't allocate memory for " | 459 | PRINT_INFO ("can't allocate memory for " |
461 | "tape info structure\n"); | 460 | "tape info structure\n"); |
462 | return ERR_PTR(-ENOMEM); | 461 | return ERR_PTR(-ENOMEM); |
463 | } | 462 | } |
464 | memset(device, 0, sizeof(struct tape_device)); | 463 | device->modeset_byte = kmalloc(1, GFP_KERNEL | GFP_DMA); |
465 | device->modeset_byte = (char *) kmalloc(1, GFP_KERNEL | GFP_DMA); | ||
466 | if (device->modeset_byte == NULL) { | 464 | if (device->modeset_byte == NULL) { |
467 | DBF_EXCEPTION(2, "ti:no mem\n"); | 465 | DBF_EXCEPTION(2, "ti:no mem\n"); |
468 | PRINT_INFO("can't allocate memory for modeset byte\n"); | 466 | PRINT_INFO("can't allocate memory for modeset byte\n"); |
@@ -659,34 +657,30 @@ tape_alloc_request(int cplength, int datasize) | |||
659 | 657 | ||
660 | DBF_LH(6, "tape_alloc_request(%d, %d)\n", cplength, datasize); | 658 | DBF_LH(6, "tape_alloc_request(%d, %d)\n", cplength, datasize); |
661 | 659 | ||
662 | request = (struct tape_request *) kmalloc(sizeof(struct tape_request), | 660 | request = kzalloc(sizeof(struct tape_request), GFP_KERNEL); |
663 | GFP_KERNEL); | ||
664 | if (request == NULL) { | 661 | if (request == NULL) { |
665 | DBF_EXCEPTION(1, "cqra nomem\n"); | 662 | DBF_EXCEPTION(1, "cqra nomem\n"); |
666 | return ERR_PTR(-ENOMEM); | 663 | return ERR_PTR(-ENOMEM); |
667 | } | 664 | } |
668 | memset(request, 0, sizeof(struct tape_request)); | ||
669 | /* allocate channel program */ | 665 | /* allocate channel program */ |
670 | if (cplength > 0) { | 666 | if (cplength > 0) { |
671 | request->cpaddr = kmalloc(cplength*sizeof(struct ccw1), | 667 | request->cpaddr = kcalloc(cplength, sizeof(struct ccw1), |
672 | GFP_ATOMIC | GFP_DMA); | 668 | GFP_ATOMIC | GFP_DMA); |
673 | if (request->cpaddr == NULL) { | 669 | if (request->cpaddr == NULL) { |
674 | DBF_EXCEPTION(1, "cqra nomem\n"); | 670 | DBF_EXCEPTION(1, "cqra nomem\n"); |
675 | kfree(request); | 671 | kfree(request); |
676 | return ERR_PTR(-ENOMEM); | 672 | return ERR_PTR(-ENOMEM); |
677 | } | 673 | } |
678 | memset(request->cpaddr, 0, cplength*sizeof(struct ccw1)); | ||
679 | } | 674 | } |
680 | /* alloc small kernel buffer */ | 675 | /* alloc small kernel buffer */ |
681 | if (datasize > 0) { | 676 | if (datasize > 0) { |
682 | request->cpdata = kmalloc(datasize, GFP_KERNEL | GFP_DMA); | 677 | request->cpdata = kzalloc(datasize, GFP_KERNEL | GFP_DMA); |
683 | if (request->cpdata == NULL) { | 678 | if (request->cpdata == NULL) { |
684 | DBF_EXCEPTION(1, "cqra nomem\n"); | 679 | DBF_EXCEPTION(1, "cqra nomem\n"); |
685 | kfree(request->cpaddr); | 680 | kfree(request->cpaddr); |
686 | kfree(request); | 681 | kfree(request); |
687 | return ERR_PTR(-ENOMEM); | 682 | return ERR_PTR(-ENOMEM); |
688 | } | 683 | } |
689 | memset(request->cpdata, 0, datasize); | ||
690 | } | 684 | } |
691 | DBF_LH(6, "New request %p(%p/%p)\n", request, request->cpaddr, | 685 | DBF_LH(6, "New request %p(%p/%p)\n", request, request->cpaddr, |
692 | request->cpdata); | 686 | request->cpdata); |
diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c index 4b9069370388..9a141776873f 100644 --- a/drivers/s390/char/tty3270.c +++ b/drivers/s390/char/tty3270.c | |||
@@ -691,10 +691,9 @@ tty3270_alloc_view(void) | |||
691 | struct tty3270 *tp; | 691 | struct tty3270 *tp; |
692 | int pages; | 692 | int pages; |
693 | 693 | ||
694 | tp = kmalloc(sizeof(struct tty3270),GFP_KERNEL); | 694 | tp = kzalloc(sizeof(struct tty3270), GFP_KERNEL); |
695 | if (!tp) | 695 | if (!tp) |
696 | goto out_err; | 696 | goto out_err; |
697 | memset(tp, 0, sizeof(struct tty3270)); | ||
698 | tp->freemem_pages = | 697 | tp->freemem_pages = |
699 | kmalloc(sizeof(void *) * TTY3270_STRING_PAGES, GFP_KERNEL); | 698 | kmalloc(sizeof(void *) * TTY3270_STRING_PAGES, GFP_KERNEL); |
700 | if (!tp->freemem_pages) | 699 | if (!tp->freemem_pages) |
@@ -767,16 +766,14 @@ tty3270_alloc_screen(struct tty3270 *tp) | |||
767 | int lines; | 766 | int lines; |
768 | 767 | ||
769 | size = sizeof(struct tty3270_line) * (tp->view.rows - 2); | 768 | size = sizeof(struct tty3270_line) * (tp->view.rows - 2); |
770 | tp->screen = kmalloc(size, GFP_KERNEL); | 769 | tp->screen = kzalloc(size, GFP_KERNEL); |
771 | if (!tp->screen) | 770 | if (!tp->screen) |
772 | goto out_err; | 771 | goto out_err; |
773 | memset(tp->screen, 0, size); | ||
774 | for (lines = 0; lines < tp->view.rows - 2; lines++) { | 772 | for (lines = 0; lines < tp->view.rows - 2; lines++) { |
775 | size = sizeof(struct tty3270_cell) * tp->view.cols; | 773 | size = sizeof(struct tty3270_cell) * tp->view.cols; |
776 | tp->screen[lines].cells = kmalloc(size, GFP_KERNEL); | 774 | tp->screen[lines].cells = kzalloc(size, GFP_KERNEL); |
777 | if (!tp->screen[lines].cells) | 775 | if (!tp->screen[lines].cells) |
778 | goto out_screen; | 776 | goto out_screen; |
779 | memset(tp->screen[lines].cells, 0, size); | ||
780 | } | 777 | } |
781 | return 0; | 778 | return 0; |
782 | out_screen: | 779 | out_screen: |
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c index b2d75de144c6..c625b69ebd19 100644 --- a/drivers/s390/char/vmlogrdr.c +++ b/drivers/s390/char/vmlogrdr.c | |||
@@ -759,9 +759,8 @@ vmlogrdr_register_device(struct vmlogrdr_priv_t *priv) { | |||
759 | struct device *dev; | 759 | struct device *dev; |
760 | int ret; | 760 | int ret; |
761 | 761 | ||
762 | dev = kmalloc(sizeof(struct device), GFP_KERNEL); | 762 | dev = kzalloc(sizeof(struct device), GFP_KERNEL); |
763 | if (dev) { | 763 | if (dev) { |
764 | memset(dev, 0, sizeof(struct device)); | ||
765 | snprintf(dev->bus_id, BUS_ID_SIZE, "%s", | 764 | snprintf(dev->bus_id, BUS_ID_SIZE, "%s", |
766 | priv->internal_name); | 765 | priv->internal_name); |
767 | dev->bus = &iucv_bus; | 766 | dev->bus = &iucv_bus; |
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c index 8013c8eb76fe..bdfee7fbaa2e 100644 --- a/drivers/s390/cio/ccwgroup.c +++ b/drivers/s390/cio/ccwgroup.c | |||
@@ -157,11 +157,10 @@ ccwgroup_create(struct device *root, | |||
157 | if (argc > 256) /* disallow dumb users */ | 157 | if (argc > 256) /* disallow dumb users */ |
158 | return -EINVAL; | 158 | return -EINVAL; |
159 | 159 | ||
160 | gdev = kmalloc(sizeof(*gdev) + argc*sizeof(gdev->cdev[0]), GFP_KERNEL); | 160 | gdev = kzalloc(sizeof(*gdev) + argc*sizeof(gdev->cdev[0]), GFP_KERNEL); |
161 | if (!gdev) | 161 | if (!gdev) |
162 | return -ENOMEM; | 162 | return -ENOMEM; |
163 | 163 | ||
164 | memset(gdev, 0, sizeof(*gdev) + argc*sizeof(gdev->cdev[0])); | ||
165 | atomic_set(&gdev->onoff, 0); | 164 | atomic_set(&gdev->onoff, 0); |
166 | 165 | ||
167 | del_drvdata = 0; | 166 | del_drvdata = 0; |
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c index 8b57fe62a9f9..6412b2c3edd3 100644 --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c | |||
@@ -1403,10 +1403,9 @@ new_channel_path(int chpid) | |||
1403 | struct channel_path *chp; | 1403 | struct channel_path *chp; |
1404 | int ret; | 1404 | int ret; |
1405 | 1405 | ||
1406 | chp = kmalloc(sizeof(struct channel_path), GFP_KERNEL); | 1406 | chp = kzalloc(sizeof(struct channel_path), GFP_KERNEL); |
1407 | if (!chp) | 1407 | if (!chp) |
1408 | return -ENOMEM; | 1408 | return -ENOMEM; |
1409 | memset(chp, 0, sizeof(struct channel_path)); | ||
1410 | 1409 | ||
1411 | /* fill in status, etc. */ | 1410 | /* fill in status, etc. */ |
1412 | chp->id = chpid; | 1411 | chp->id = chpid; |
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index 5b304dbacaeb..74ea8aac4b7d 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
@@ -630,10 +630,9 @@ css_enqueue_subchannel_slow(struct subchannel_id schid) | |||
630 | struct slow_subchannel *new_slow_sch; | 630 | struct slow_subchannel *new_slow_sch; |
631 | unsigned long flags; | 631 | unsigned long flags; |
632 | 632 | ||
633 | new_slow_sch = kmalloc(sizeof(struct slow_subchannel), GFP_ATOMIC); | 633 | new_slow_sch = kzalloc(sizeof(struct slow_subchannel), GFP_ATOMIC); |
634 | if (!new_slow_sch) | 634 | if (!new_slow_sch) |
635 | return -ENOMEM; | 635 | return -ENOMEM; |
636 | memset(new_slow_sch, 0, sizeof(struct slow_subchannel)); | ||
637 | new_slow_sch->schid = schid; | 636 | new_slow_sch->schid = schid; |
638 | spin_lock_irqsave(&slow_subchannel_lock, flags); | 637 | spin_lock_irqsave(&slow_subchannel_lock, flags); |
639 | list_add_tail(&new_slow_sch->slow_list, &slow_subchannels_head); | 638 | list_add_tail(&new_slow_sch->slow_list, &slow_subchannels_head); |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index afc4e88551ad..8e3053c2a451 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -826,17 +826,15 @@ io_subchannel_probe (struct subchannel *sch) | |||
826 | get_device(&cdev->dev); | 826 | get_device(&cdev->dev); |
827 | return 0; | 827 | return 0; |
828 | } | 828 | } |
829 | cdev = kmalloc (sizeof(*cdev), GFP_KERNEL); | 829 | cdev = kzalloc (sizeof(*cdev), GFP_KERNEL); |
830 | if (!cdev) | 830 | if (!cdev) |
831 | return -ENOMEM; | 831 | return -ENOMEM; |
832 | memset(cdev, 0, sizeof(struct ccw_device)); | 832 | cdev->private = kzalloc(sizeof(struct ccw_device_private), |
833 | cdev->private = kmalloc(sizeof(struct ccw_device_private), | ||
834 | GFP_KERNEL | GFP_DMA); | 833 | GFP_KERNEL | GFP_DMA); |
835 | if (!cdev->private) { | 834 | if (!cdev->private) { |
836 | kfree(cdev); | 835 | kfree(cdev); |
837 | return -ENOMEM; | 836 | return -ENOMEM; |
838 | } | 837 | } |
839 | memset(cdev->private, 0, sizeof(struct ccw_device_private)); | ||
840 | atomic_set(&cdev->private->onoff, 0); | 838 | atomic_set(&cdev->private->onoff, 0); |
841 | cdev->dev = (struct device) { | 839 | cdev->dev = (struct device) { |
842 | .parent = &sch->dev, | 840 | .parent = &sch->dev, |
diff --git a/drivers/s390/cio/device_ops.c b/drivers/s390/cio/device_ops.c index 3a50b1903287..795abb5a65ba 100644 --- a/drivers/s390/cio/device_ops.c +++ b/drivers/s390/cio/device_ops.c | |||
@@ -359,10 +359,9 @@ read_dev_chars (struct ccw_device *cdev, void **buffer, int length) | |||
359 | CIO_TRACE_EVENT (4, "rddevch"); | 359 | CIO_TRACE_EVENT (4, "rddevch"); |
360 | CIO_TRACE_EVENT (4, sch->dev.bus_id); | 360 | CIO_TRACE_EVENT (4, sch->dev.bus_id); |
361 | 361 | ||
362 | rdc_ccw = kmalloc(sizeof(struct ccw1), GFP_KERNEL | GFP_DMA); | 362 | rdc_ccw = kzalloc(sizeof(struct ccw1), GFP_KERNEL | GFP_DMA); |
363 | if (!rdc_ccw) | 363 | if (!rdc_ccw) |
364 | return -ENOMEM; | 364 | return -ENOMEM; |
365 | memset(rdc_ccw, 0, sizeof(struct ccw1)); | ||
366 | rdc_ccw->cmd_code = CCW_CMD_RDC; | 365 | rdc_ccw->cmd_code = CCW_CMD_RDC; |
367 | rdc_ccw->count = length; | 366 | rdc_ccw->count = length; |
368 | rdc_ccw->flags = CCW_FLAG_SLI; | 367 | rdc_ccw->flags = CCW_FLAG_SLI; |
@@ -426,16 +425,14 @@ read_conf_data_lpm (struct ccw_device *cdev, void **buffer, int *length, __u8 lp | |||
426 | if (!ciw || ciw->cmd == 0) | 425 | if (!ciw || ciw->cmd == 0) |
427 | return -EOPNOTSUPP; | 426 | return -EOPNOTSUPP; |
428 | 427 | ||
429 | rcd_ccw = kmalloc(sizeof(struct ccw1), GFP_KERNEL | GFP_DMA); | 428 | rcd_ccw = kzalloc(sizeof(struct ccw1), GFP_KERNEL | GFP_DMA); |
430 | if (!rcd_ccw) | 429 | if (!rcd_ccw) |
431 | return -ENOMEM; | 430 | return -ENOMEM; |
432 | memset(rcd_ccw, 0, sizeof(struct ccw1)); | 431 | rcd_buf = kzalloc(ciw->count, GFP_KERNEL | GFP_DMA); |
433 | rcd_buf = kmalloc(ciw->count, GFP_KERNEL | GFP_DMA); | ||
434 | if (!rcd_buf) { | 432 | if (!rcd_buf) { |
435 | kfree(rcd_ccw); | 433 | kfree(rcd_ccw); |
436 | return -ENOMEM; | 434 | return -ENOMEM; |
437 | } | 435 | } |
438 | memset (rcd_buf, 0, ciw->count); | ||
439 | rcd_ccw->cmd_code = ciw->cmd; | 436 | rcd_ccw->cmd_code = ciw->cmd; |
440 | rcd_ccw->cda = (__u32) __pa (rcd_buf); | 437 | rcd_ccw->cda = (__u32) __pa (rcd_buf); |
441 | rcd_ccw->count = ciw->count; | 438 | rcd_ccw->count = ciw->count; |
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c index 9ed37dc9a1b0..814f9258ce00 100644 --- a/drivers/s390/cio/qdio.c +++ b/drivers/s390/cio/qdio.c | |||
@@ -1686,16 +1686,14 @@ qdio_alloc_qs(struct qdio_irq *irq_ptr, | |||
1686 | int result=-ENOMEM; | 1686 | int result=-ENOMEM; |
1687 | 1687 | ||
1688 | for (i=0;i<no_input_qs;i++) { | 1688 | for (i=0;i<no_input_qs;i++) { |
1689 | q=kmalloc(sizeof(struct qdio_q),GFP_KERNEL); | 1689 | q = kzalloc(sizeof(struct qdio_q), GFP_KERNEL); |
1690 | 1690 | ||
1691 | if (!q) { | 1691 | if (!q) { |
1692 | QDIO_PRINT_ERR("kmalloc of q failed!\n"); | 1692 | QDIO_PRINT_ERR("kmalloc of q failed!\n"); |
1693 | goto out; | 1693 | goto out; |
1694 | } | 1694 | } |
1695 | 1695 | ||
1696 | memset(q,0,sizeof(struct qdio_q)); | 1696 | q->slib = kmalloc(PAGE_SIZE, GFP_KERNEL); |
1697 | |||
1698 | q->slib=kmalloc(PAGE_SIZE,GFP_KERNEL); | ||
1699 | if (!q->slib) { | 1697 | if (!q->slib) { |
1700 | QDIO_PRINT_ERR("kmalloc of slib failed!\n"); | 1698 | QDIO_PRINT_ERR("kmalloc of slib failed!\n"); |
1701 | goto out; | 1699 | goto out; |
@@ -1705,14 +1703,12 @@ qdio_alloc_qs(struct qdio_irq *irq_ptr, | |||
1705 | } | 1703 | } |
1706 | 1704 | ||
1707 | for (i=0;i<no_output_qs;i++) { | 1705 | for (i=0;i<no_output_qs;i++) { |
1708 | q=kmalloc(sizeof(struct qdio_q),GFP_KERNEL); | 1706 | q = kzalloc(sizeof(struct qdio_q), GFP_KERNEL); |
1709 | 1707 | ||
1710 | if (!q) { | 1708 | if (!q) { |
1711 | goto out; | 1709 | goto out; |
1712 | } | 1710 | } |
1713 | 1711 | ||
1714 | memset(q,0,sizeof(struct qdio_q)); | ||
1715 | |||
1716 | q->slib=kmalloc(PAGE_SIZE,GFP_KERNEL); | 1712 | q->slib=kmalloc(PAGE_SIZE,GFP_KERNEL); |
1717 | if (!q->slib) { | 1713 | if (!q->slib) { |
1718 | QDIO_PRINT_ERR("kmalloc of slib failed!\n"); | 1714 | QDIO_PRINT_ERR("kmalloc of slib failed!\n"); |
@@ -2984,7 +2980,7 @@ qdio_allocate(struct qdio_initialize *init_data) | |||
2984 | qdio_allocate_do_dbf(init_data); | 2980 | qdio_allocate_do_dbf(init_data); |
2985 | 2981 | ||
2986 | /* create irq */ | 2982 | /* create irq */ |
2987 | irq_ptr=kmalloc(sizeof(struct qdio_irq), GFP_KERNEL | GFP_DMA); | 2983 | irq_ptr = kzalloc(sizeof(struct qdio_irq), GFP_KERNEL | GFP_DMA); |
2988 | 2984 | ||
2989 | QDIO_DBF_TEXT0(0,setup,"irq_ptr:"); | 2985 | QDIO_DBF_TEXT0(0,setup,"irq_ptr:"); |
2990 | QDIO_DBF_HEX0(0,setup,&irq_ptr,sizeof(void*)); | 2986 | QDIO_DBF_HEX0(0,setup,&irq_ptr,sizeof(void*)); |
@@ -2994,8 +2990,6 @@ qdio_allocate(struct qdio_initialize *init_data) | |||
2994 | return -ENOMEM; | 2990 | return -ENOMEM; |
2995 | } | 2991 | } |
2996 | 2992 | ||
2997 | memset(irq_ptr,0,sizeof(struct qdio_irq)); | ||
2998 | |||
2999 | init_MUTEX(&irq_ptr->setting_up_sema); | 2993 | init_MUTEX(&irq_ptr->setting_up_sema); |
3000 | 2994 | ||
3001 | /* QDR must be in DMA area since CCW data address is only 32 bit */ | 2995 | /* QDR must be in DMA area since CCW data address is only 32 bit */ |
@@ -3686,10 +3680,10 @@ qdio_get_qdio_memory(void) | |||
3686 | 3680 | ||
3687 | for (i=1;i<INDICATORS_PER_CACHELINE;i++) | 3681 | for (i=1;i<INDICATORS_PER_CACHELINE;i++) |
3688 | indicator_used[i]=0; | 3682 | indicator_used[i]=0; |
3689 | indicators=(__u32*)kmalloc(sizeof(__u32)*(INDICATORS_PER_CACHELINE), | 3683 | indicators = kzalloc(sizeof(__u32)*(INDICATORS_PER_CACHELINE), |
3690 | GFP_KERNEL); | 3684 | GFP_KERNEL); |
3691 | if (!indicators) return -ENOMEM; | 3685 | if (!indicators) |
3692 | memset(indicators,0,sizeof(__u32)*(INDICATORS_PER_CACHELINE)); | 3686 | return -ENOMEM; |
3693 | return 0; | 3687 | return 0; |
3694 | } | 3688 | } |
3695 | 3689 | ||
diff --git a/drivers/s390/crypto/z90main.c b/drivers/s390/crypto/z90main.c index 977ecd9ba6bd..982acc7303ea 100644 --- a/drivers/s390/crypto/z90main.c +++ b/drivers/s390/crypto/z90main.c | |||
@@ -707,13 +707,12 @@ z90crypt_open(struct inode *inode, struct file *filp) | |||
707 | if (quiesce_z90crypt) | 707 | if (quiesce_z90crypt) |
708 | return -EQUIESCE; | 708 | return -EQUIESCE; |
709 | 709 | ||
710 | private_data_p = kmalloc(sizeof(struct priv_data), GFP_KERNEL); | 710 | private_data_p = kzalloc(sizeof(struct priv_data), GFP_KERNEL); |
711 | if (!private_data_p) { | 711 | if (!private_data_p) { |
712 | PRINTK("Memory allocate failed\n"); | 712 | PRINTK("Memory allocate failed\n"); |
713 | return -ENOMEM; | 713 | return -ENOMEM; |
714 | } | 714 | } |
715 | 715 | ||
716 | memset((void *)private_data_p, 0, sizeof(struct priv_data)); | ||
717 | private_data_p->status = STAT_OPEN; | 716 | private_data_p->status = STAT_OPEN; |
718 | private_data_p->opener_pid = PID(); | 717 | private_data_p->opener_pid = PID(); |
719 | filp->private_data = private_data_p; | 718 | filp->private_data = private_data_p; |
@@ -2737,13 +2736,11 @@ create_z90crypt(int *cdx_p) | |||
2737 | z90crypt.max_count = Z90CRYPT_NUM_DEVS; | 2736 | z90crypt.max_count = Z90CRYPT_NUM_DEVS; |
2738 | z90crypt.cdx = *cdx_p; | 2737 | z90crypt.cdx = *cdx_p; |
2739 | 2738 | ||
2740 | hdware_blk_p = (struct hdware_block *) | 2739 | hdware_blk_p = kzalloc(sizeof(struct hdware_block), GFP_ATOMIC); |
2741 | kmalloc(sizeof(struct hdware_block), GFP_ATOMIC); | ||
2742 | if (!hdware_blk_p) { | 2740 | if (!hdware_blk_p) { |
2743 | PDEBUG("kmalloc for hardware block failed\n"); | 2741 | PDEBUG("kmalloc for hardware block failed\n"); |
2744 | return ENOMEM; | 2742 | return ENOMEM; |
2745 | } | 2743 | } |
2746 | memset(hdware_blk_p, 0x00, sizeof(struct hdware_block)); | ||
2747 | z90crypt.hdware_info = hdware_blk_p; | 2744 | z90crypt.hdware_info = hdware_blk_p; |
2748 | 2745 | ||
2749 | return 0; | 2746 | return 0; |
@@ -2978,12 +2975,11 @@ create_crypto_device(int index) | |||
2978 | total_size = sizeof(struct device) + | 2975 | total_size = sizeof(struct device) + |
2979 | z90crypt.q_depth_array[index] * sizeof(int); | 2976 | z90crypt.q_depth_array[index] * sizeof(int); |
2980 | 2977 | ||
2981 | dev_ptr = (struct device *) kmalloc(total_size, GFP_ATOMIC); | 2978 | dev_ptr = kzalloc(total_size, GFP_ATOMIC); |
2982 | if (!dev_ptr) { | 2979 | if (!dev_ptr) { |
2983 | PRINTK("kmalloc device %d failed\n", index); | 2980 | PRINTK("kmalloc device %d failed\n", index); |
2984 | return ENOMEM; | 2981 | return ENOMEM; |
2985 | } | 2982 | } |
2986 | memset(dev_ptr, 0, total_size); | ||
2987 | dev_ptr->dev_resp_p = kmalloc(MAX_RESPONSE_SIZE, GFP_ATOMIC); | 2983 | dev_ptr->dev_resp_p = kmalloc(MAX_RESPONSE_SIZE, GFP_ATOMIC); |
2988 | if (!dev_ptr->dev_resp_p) { | 2984 | if (!dev_ptr->dev_resp_p) { |
2989 | kfree(dev_ptr); | 2985 | kfree(dev_ptr); |
diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c index acd2a3f005f1..23d53bf9daf1 100644 --- a/drivers/s390/net/claw.c +++ b/drivers/s390/net/claw.c | |||
@@ -310,7 +310,7 @@ claw_probe(struct ccwgroup_device *cgdev) | |||
310 | printk(KERN_INFO "claw: variable cgdev =\n"); | 310 | printk(KERN_INFO "claw: variable cgdev =\n"); |
311 | dumpit((char *)cgdev, sizeof(struct ccwgroup_device)); | 311 | dumpit((char *)cgdev, sizeof(struct ccwgroup_device)); |
312 | #endif | 312 | #endif |
313 | privptr = kmalloc(sizeof(struct claw_privbk), GFP_KERNEL); | 313 | privptr = kzalloc(sizeof(struct claw_privbk), GFP_KERNEL); |
314 | if (privptr == NULL) { | 314 | if (privptr == NULL) { |
315 | probe_error(cgdev); | 315 | probe_error(cgdev); |
316 | put_device(&cgdev->dev); | 316 | put_device(&cgdev->dev); |
@@ -319,7 +319,6 @@ claw_probe(struct ccwgroup_device *cgdev) | |||
319 | CLAW_DBF_TEXT_(2,setup,"probex%d",-ENOMEM); | 319 | CLAW_DBF_TEXT_(2,setup,"probex%d",-ENOMEM); |
320 | return -ENOMEM; | 320 | return -ENOMEM; |
321 | } | 321 | } |
322 | memset(privptr,0x00,sizeof(struct claw_privbk)); | ||
323 | privptr->p_mtc_envelope= kmalloc( MAX_ENVELOPE_SIZE, GFP_KERNEL); | 322 | privptr->p_mtc_envelope= kmalloc( MAX_ENVELOPE_SIZE, GFP_KERNEL); |
324 | privptr->p_env = kmalloc(sizeof(struct claw_env), GFP_KERNEL); | 323 | privptr->p_env = kmalloc(sizeof(struct claw_env), GFP_KERNEL); |
325 | if ((privptr->p_mtc_envelope==NULL) || (privptr->p_env==NULL)) { | 324 | if ((privptr->p_mtc_envelope==NULL) || (privptr->p_env==NULL)) { |
diff --git a/drivers/s390/net/fsm.c b/drivers/s390/net/fsm.c index 6caf5fa6a3b5..7145e2134cf0 100644 --- a/drivers/s390/net/fsm.c +++ b/drivers/s390/net/fsm.c | |||
@@ -21,38 +21,34 @@ init_fsm(char *name, const char **state_names, const char **event_names, int nr_ | |||
21 | fsm_function_t *m; | 21 | fsm_function_t *m; |
22 | fsm *f; | 22 | fsm *f; |
23 | 23 | ||
24 | this = (fsm_instance *)kmalloc(sizeof(fsm_instance), order); | 24 | this = kzalloc(sizeof(fsm_instance), order); |
25 | if (this == NULL) { | 25 | if (this == NULL) { |
26 | printk(KERN_WARNING | 26 | printk(KERN_WARNING |
27 | "fsm(%s): init_fsm: Couldn't alloc instance\n", name); | 27 | "fsm(%s): init_fsm: Couldn't alloc instance\n", name); |
28 | return NULL; | 28 | return NULL; |
29 | } | 29 | } |
30 | memset(this, 0, sizeof(fsm_instance)); | ||
31 | strlcpy(this->name, name, sizeof(this->name)); | 30 | strlcpy(this->name, name, sizeof(this->name)); |
32 | 31 | ||
33 | f = (fsm *)kmalloc(sizeof(fsm), order); | 32 | f = kzalloc(sizeof(fsm), order); |
34 | if (f == NULL) { | 33 | if (f == NULL) { |
35 | printk(KERN_WARNING | 34 | printk(KERN_WARNING |
36 | "fsm(%s): init_fsm: Couldn't alloc fsm\n", name); | 35 | "fsm(%s): init_fsm: Couldn't alloc fsm\n", name); |
37 | kfree_fsm(this); | 36 | kfree_fsm(this); |
38 | return NULL; | 37 | return NULL; |
39 | } | 38 | } |
40 | memset(f, 0, sizeof(fsm)); | ||
41 | f->nr_events = nr_events; | 39 | f->nr_events = nr_events; |
42 | f->nr_states = nr_states; | 40 | f->nr_states = nr_states; |
43 | f->event_names = event_names; | 41 | f->event_names = event_names; |
44 | f->state_names = state_names; | 42 | f->state_names = state_names; |
45 | this->f = f; | 43 | this->f = f; |
46 | 44 | ||
47 | m = (fsm_function_t *)kmalloc( | 45 | m = kcalloc(nr_states*nr_events, sizeof(fsm_function_t), order); |
48 | sizeof(fsm_function_t) * nr_states * nr_events, order); | ||
49 | if (m == NULL) { | 46 | if (m == NULL) { |
50 | printk(KERN_WARNING | 47 | printk(KERN_WARNING |
51 | "fsm(%s): init_fsm: Couldn't alloc jumptable\n", name); | 48 | "fsm(%s): init_fsm: Couldn't alloc jumptable\n", name); |
52 | kfree_fsm(this); | 49 | kfree_fsm(this); |
53 | return NULL; | 50 | return NULL; |
54 | } | 51 | } |
55 | memset(m, 0, sizeof(fsm_function_t) * f->nr_states * f->nr_events); | ||
56 | f->jumpmatrix = m; | 52 | f->jumpmatrix = m; |
57 | 53 | ||
58 | for (i = 0; i < tmpl_len; i++) { | 54 | for (i = 0; i < tmpl_len; i++) { |
diff --git a/drivers/s390/net/iucv.c b/drivers/s390/net/iucv.c index 760e77ec5a11..6190be9dca99 100644 --- a/drivers/s390/net/iucv.c +++ b/drivers/s390/net/iucv.c | |||
@@ -386,7 +386,7 @@ iucv_init(void) | |||
386 | } | 386 | } |
387 | 387 | ||
388 | /* Note: GFP_DMA used used to get memory below 2G */ | 388 | /* Note: GFP_DMA used used to get memory below 2G */ |
389 | iucv_external_int_buffer = kmalloc(sizeof(iucv_GeneralInterrupt), | 389 | iucv_external_int_buffer = kzalloc(sizeof(iucv_GeneralInterrupt), |
390 | GFP_KERNEL|GFP_DMA); | 390 | GFP_KERNEL|GFP_DMA); |
391 | if (!iucv_external_int_buffer) { | 391 | if (!iucv_external_int_buffer) { |
392 | printk(KERN_WARNING | 392 | printk(KERN_WARNING |
@@ -396,10 +396,9 @@ iucv_init(void) | |||
396 | bus_unregister(&iucv_bus); | 396 | bus_unregister(&iucv_bus); |
397 | return -ENOMEM; | 397 | return -ENOMEM; |
398 | } | 398 | } |
399 | memset(iucv_external_int_buffer, 0, sizeof(iucv_GeneralInterrupt)); | ||
400 | 399 | ||
401 | /* Initialize parameter pool */ | 400 | /* Initialize parameter pool */ |
402 | iucv_param_pool = kmalloc(sizeof(iucv_param) * PARAM_POOL_SIZE, | 401 | iucv_param_pool = kzalloc(sizeof(iucv_param) * PARAM_POOL_SIZE, |
403 | GFP_KERNEL|GFP_DMA); | 402 | GFP_KERNEL|GFP_DMA); |
404 | if (!iucv_param_pool) { | 403 | if (!iucv_param_pool) { |
405 | printk(KERN_WARNING "%s: Could not allocate param pool\n", | 404 | printk(KERN_WARNING "%s: Could not allocate param pool\n", |
@@ -410,7 +409,6 @@ iucv_init(void) | |||
410 | bus_unregister(&iucv_bus); | 409 | bus_unregister(&iucv_bus); |
411 | return -ENOMEM; | 410 | return -ENOMEM; |
412 | } | 411 | } |
413 | memset(iucv_param_pool, 0, sizeof(iucv_param) * PARAM_POOL_SIZE); | ||
414 | 412 | ||
415 | /* Initialize irq queue */ | 413 | /* Initialize irq queue */ |
416 | INIT_LIST_HEAD(&iucv_irq_queue); | 414 | INIT_LIST_HEAD(&iucv_irq_queue); |
@@ -793,15 +791,14 @@ iucv_register_program (__u8 pgmname[16], | |||
793 | } | 791 | } |
794 | 792 | ||
795 | max_connections = iucv_query_maxconn(); | 793 | max_connections = iucv_query_maxconn(); |
796 | iucv_pathid_table = kmalloc(max_connections * sizeof(handler *), | 794 | iucv_pathid_table = kcalloc(max_connections, sizeof(handler *), |
797 | GFP_ATOMIC); | 795 | GFP_ATOMIC); |
798 | if (iucv_pathid_table == NULL) { | 796 | if (iucv_pathid_table == NULL) { |
799 | printk(KERN_WARNING "%s: iucv_pathid_table storage " | 797 | printk(KERN_WARNING "%s: iucv_pathid_table storage " |
800 | "allocation failed\n", __FUNCTION__); | 798 | "allocation failed\n", __FUNCTION__); |
801 | kfree(new_handler); | 799 | kfree(new_handler); |
802 | return NULL; | 800 | return NULL; |
803 | } | 801 | } |
804 | memset (iucv_pathid_table, 0, max_connections * sizeof(handler *)); | ||
805 | } | 802 | } |
806 | memset(new_handler, 0, sizeof (handler)); | 803 | memset(new_handler, 0, sizeof (handler)); |
807 | memcpy(new_handler->id.user_data, pgmname, | 804 | memcpy(new_handler->id.user_data, pgmname, |
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c index 9cf88d7201d3..edcf05d5d568 100644 --- a/drivers/s390/net/lcs.c +++ b/drivers/s390/net/lcs.c | |||
@@ -115,11 +115,10 @@ lcs_alloc_channel(struct lcs_channel *channel) | |||
115 | LCS_DBF_TEXT(2, setup, "ichalloc"); | 115 | LCS_DBF_TEXT(2, setup, "ichalloc"); |
116 | for (cnt = 0; cnt < LCS_NUM_BUFFS; cnt++) { | 116 | for (cnt = 0; cnt < LCS_NUM_BUFFS; cnt++) { |
117 | /* alloc memory fo iobuffer */ | 117 | /* alloc memory fo iobuffer */ |
118 | channel->iob[cnt].data = (void *) | 118 | channel->iob[cnt].data = |
119 | kmalloc(LCS_IOBUFFERSIZE, GFP_DMA | GFP_KERNEL); | 119 | kzalloc(LCS_IOBUFFERSIZE, GFP_DMA | GFP_KERNEL); |
120 | if (channel->iob[cnt].data == NULL) | 120 | if (channel->iob[cnt].data == NULL) |
121 | break; | 121 | break; |
122 | memset(channel->iob[cnt].data, 0, LCS_IOBUFFERSIZE); | ||
123 | channel->iob[cnt].state = BUF_STATE_EMPTY; | 122 | channel->iob[cnt].state = BUF_STATE_EMPTY; |
124 | } | 123 | } |
125 | if (cnt < LCS_NUM_BUFFS) { | 124 | if (cnt < LCS_NUM_BUFFS) { |
@@ -182,10 +181,9 @@ lcs_alloc_card(void) | |||
182 | 181 | ||
183 | LCS_DBF_TEXT(2, setup, "alloclcs"); | 182 | LCS_DBF_TEXT(2, setup, "alloclcs"); |
184 | 183 | ||
185 | card = kmalloc(sizeof(struct lcs_card), GFP_KERNEL | GFP_DMA); | 184 | card = kzalloc(sizeof(struct lcs_card), GFP_KERNEL | GFP_DMA); |
186 | if (card == NULL) | 185 | if (card == NULL) |
187 | return NULL; | 186 | return NULL; |
188 | memset(card, 0, sizeof(struct lcs_card)); | ||
189 | card->lan_type = LCS_FRAME_TYPE_AUTO; | 187 | card->lan_type = LCS_FRAME_TYPE_AUTO; |
190 | card->pkt_seq = 0; | 188 | card->pkt_seq = 0; |
191 | card->lancmd_timeout = LCS_LANCMD_TIMEOUT_DEFAULT; | 189 | card->lancmd_timeout = LCS_LANCMD_TIMEOUT_DEFAULT; |
@@ -793,10 +791,9 @@ lcs_alloc_reply(struct lcs_cmd *cmd) | |||
793 | 791 | ||
794 | LCS_DBF_TEXT(4, trace, "getreply"); | 792 | LCS_DBF_TEXT(4, trace, "getreply"); |
795 | 793 | ||
796 | reply = kmalloc(sizeof(struct lcs_reply), GFP_ATOMIC); | 794 | reply = kzalloc(sizeof(struct lcs_reply), GFP_ATOMIC); |
797 | if (!reply) | 795 | if (!reply) |
798 | return NULL; | 796 | return NULL; |
799 | memset(reply,0,sizeof(struct lcs_reply)); | ||
800 | atomic_set(&reply->refcnt,1); | 797 | atomic_set(&reply->refcnt,1); |
801 | reply->sequence_no = cmd->sequence_no; | 798 | reply->sequence_no = cmd->sequence_no; |
802 | reply->received = 0; | 799 | reply->received = 0; |
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c index 71d3853e8682..260a93c8c442 100644 --- a/drivers/s390/net/netiucv.c +++ b/drivers/s390/net/netiucv.c | |||
@@ -1728,14 +1728,13 @@ static int | |||
1728 | netiucv_register_device(struct net_device *ndev) | 1728 | netiucv_register_device(struct net_device *ndev) |
1729 | { | 1729 | { |
1730 | struct netiucv_priv *priv = ndev->priv; | 1730 | struct netiucv_priv *priv = ndev->priv; |
1731 | struct device *dev = kmalloc(sizeof(struct device), GFP_KERNEL); | 1731 | struct device *dev = kzalloc(sizeof(struct device), GFP_KERNEL); |
1732 | int ret; | 1732 | int ret; |
1733 | 1733 | ||
1734 | 1734 | ||
1735 | IUCV_DBF_TEXT(trace, 3, __FUNCTION__); | 1735 | IUCV_DBF_TEXT(trace, 3, __FUNCTION__); |
1736 | 1736 | ||
1737 | if (dev) { | 1737 | if (dev) { |
1738 | memset(dev, 0, sizeof(struct device)); | ||
1739 | snprintf(dev->bus_id, BUS_ID_SIZE, "net%s", ndev->name); | 1738 | snprintf(dev->bus_id, BUS_ID_SIZE, "net%s", ndev->name); |
1740 | dev->bus = &iucv_bus; | 1739 | dev->bus = &iucv_bus; |
1741 | dev->parent = iucv_root; | 1740 | dev->parent = iucv_root; |
@@ -1784,11 +1783,9 @@ netiucv_new_connection(struct net_device *dev, char *username) | |||
1784 | { | 1783 | { |
1785 | struct iucv_connection **clist = &iucv_connections; | 1784 | struct iucv_connection **clist = &iucv_connections; |
1786 | struct iucv_connection *conn = | 1785 | struct iucv_connection *conn = |
1787 | (struct iucv_connection *) | 1786 | kzalloc(sizeof(struct iucv_connection), GFP_KERNEL); |
1788 | kmalloc(sizeof(struct iucv_connection), GFP_KERNEL); | ||
1789 | 1787 | ||
1790 | if (conn) { | 1788 | if (conn) { |
1791 | memset(conn, 0, sizeof(struct iucv_connection)); | ||
1792 | skb_queue_head_init(&conn->collect_queue); | 1789 | skb_queue_head_init(&conn->collect_queue); |
1793 | skb_queue_head_init(&conn->commit_queue); | 1790 | skb_queue_head_init(&conn->commit_queue); |
1794 | conn->max_buffsize = NETIUCV_BUFSIZE_DEFAULT; | 1791 | conn->max_buffsize = NETIUCV_BUFSIZE_DEFAULT; |
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; |
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index 021cd5d08c61..b3c6e7907790 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c | |||
@@ -297,12 +297,10 @@ qeth_alloc_card(void) | |||
297 | struct qeth_card *card; | 297 | struct qeth_card *card; |
298 | 298 | ||
299 | QETH_DBF_TEXT(setup, 2, "alloccrd"); | 299 | QETH_DBF_TEXT(setup, 2, "alloccrd"); |
300 | card = (struct qeth_card *) kmalloc(sizeof(struct qeth_card), | 300 | card = kzalloc(sizeof(struct qeth_card), GFP_DMA|GFP_KERNEL); |
301 | GFP_DMA|GFP_KERNEL); | ||
302 | if (!card) | 301 | if (!card) |
303 | return NULL; | 302 | return NULL; |
304 | QETH_DBF_HEX(setup, 2, &card, sizeof(void *)); | 303 | QETH_DBF_HEX(setup, 2, &card, sizeof(void *)); |
305 | memset(card, 0, sizeof(struct qeth_card)); | ||
306 | if (qeth_setup_channel(&card->read)) { | 304 | if (qeth_setup_channel(&card->read)) { |
307 | kfree(card); | 305 | kfree(card); |
308 | return NULL; | 306 | return NULL; |
@@ -1632,9 +1630,8 @@ qeth_alloc_reply(struct qeth_card *card) | |||
1632 | { | 1630 | { |
1633 | struct qeth_reply *reply; | 1631 | struct qeth_reply *reply; |
1634 | 1632 | ||
1635 | reply = kmalloc(sizeof(struct qeth_reply), GFP_ATOMIC); | 1633 | reply = kzalloc(sizeof(struct qeth_reply), GFP_ATOMIC); |
1636 | if (reply){ | 1634 | if (reply){ |
1637 | memset(reply, 0, sizeof(struct qeth_reply)); | ||
1638 | atomic_set(&reply->refcnt, 1); | 1635 | atomic_set(&reply->refcnt, 1); |
1639 | reply->card = card; | 1636 | reply->card = card; |
1640 | }; | 1637 | }; |
@@ -3348,13 +3345,11 @@ qeth_qdio_establish(struct qeth_card *card) | |||
3348 | 3345 | ||
3349 | QETH_DBF_TEXT(setup, 2, "qdioest"); | 3346 | QETH_DBF_TEXT(setup, 2, "qdioest"); |
3350 | 3347 | ||
3351 | qib_param_field = kmalloc(QDIO_MAX_BUFFERS_PER_Q * sizeof(char), | 3348 | qib_param_field = kzalloc(QDIO_MAX_BUFFERS_PER_Q * sizeof(char), |
3352 | GFP_KERNEL); | 3349 | GFP_KERNEL); |
3353 | if (!qib_param_field) | 3350 | if (!qib_param_field) |
3354 | return -ENOMEM; | 3351 | return -ENOMEM; |
3355 | 3352 | ||
3356 | memset(qib_param_field, 0, QDIO_MAX_BUFFERS_PER_Q * sizeof(char)); | ||
3357 | |||
3358 | qeth_create_qib_param_field(card, qib_param_field); | 3353 | qeth_create_qib_param_field(card, qib_param_field); |
3359 | qeth_create_qib_param_field_blkt(card, qib_param_field); | 3354 | qeth_create_qib_param_field_blkt(card, qib_param_field); |
3360 | 3355 | ||
@@ -4819,9 +4814,8 @@ qeth_arp_query(struct qeth_card *card, char *udata) | |||
4819 | /* get size of userspace buffer and mask_bits -> 6 bytes */ | 4814 | /* get size of userspace buffer and mask_bits -> 6 bytes */ |
4820 | if (copy_from_user(&qinfo, udata, 6)) | 4815 | if (copy_from_user(&qinfo, udata, 6)) |
4821 | return -EFAULT; | 4816 | return -EFAULT; |
4822 | if (!(qinfo.udata = kmalloc(qinfo.udata_len, GFP_KERNEL))) | 4817 | if (!(qinfo.udata = kzalloc(qinfo.udata_len, GFP_KERNEL))) |
4823 | return -ENOMEM; | 4818 | return -ENOMEM; |
4824 | memset(qinfo.udata, 0, qinfo.udata_len); | ||
4825 | qinfo.udata_offset = QETH_QARP_ENTRIES_OFFSET; | 4819 | qinfo.udata_offset = QETH_QARP_ENTRIES_OFFSET; |
4826 | iob = qeth_get_setassparms_cmd(card, IPA_ARP_PROCESSING, | 4820 | iob = qeth_get_setassparms_cmd(card, IPA_ARP_PROCESSING, |
4827 | IPA_CMD_ASS_ARP_QUERY_INFO, | 4821 | IPA_CMD_ASS_ARP_QUERY_INFO, |
@@ -4969,11 +4963,10 @@ qeth_snmp_command(struct qeth_card *card, char *udata) | |||
4969 | return -EFAULT; | 4963 | return -EFAULT; |
4970 | } | 4964 | } |
4971 | qinfo.udata_len = ureq->hdr.data_len; | 4965 | qinfo.udata_len = ureq->hdr.data_len; |
4972 | if (!(qinfo.udata = kmalloc(qinfo.udata_len, GFP_KERNEL))){ | 4966 | if (!(qinfo.udata = kzalloc(qinfo.udata_len, GFP_KERNEL))){ |
4973 | kfree(ureq); | 4967 | kfree(ureq); |
4974 | return -ENOMEM; | 4968 | return -ENOMEM; |
4975 | } | 4969 | } |
4976 | memset(qinfo.udata, 0, qinfo.udata_len); | ||
4977 | qinfo.udata_offset = sizeof(struct qeth_snmp_ureq_hdr); | 4970 | qinfo.udata_offset = sizeof(struct qeth_snmp_ureq_hdr); |
4978 | 4971 | ||
4979 | iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_SNMP_CONTROL, | 4972 | iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_SNMP_CONTROL, |
@@ -5564,12 +5557,11 @@ qeth_get_addr_buffer(enum qeth_prot_versions prot) | |||
5564 | { | 5557 | { |
5565 | struct qeth_ipaddr *addr; | 5558 | struct qeth_ipaddr *addr; |
5566 | 5559 | ||
5567 | addr = kmalloc(sizeof(struct qeth_ipaddr), GFP_ATOMIC); | 5560 | addr = kzalloc(sizeof(struct qeth_ipaddr), GFP_ATOMIC); |
5568 | if (addr == NULL) { | 5561 | if (addr == NULL) { |
5569 | PRINT_WARN("Not enough memory to add address\n"); | 5562 | PRINT_WARN("Not enough memory to add address\n"); |
5570 | return NULL; | 5563 | return NULL; |
5571 | } | 5564 | } |
5572 | memset(addr,0,sizeof(struct qeth_ipaddr)); | ||
5573 | addr->type = QETH_IP_TYPE_NORMAL; | 5565 | addr->type = QETH_IP_TYPE_NORMAL; |
5574 | addr->proto = prot; | 5566 | addr->proto = prot; |
5575 | return addr; | 5567 | return addr; |
diff --git a/drivers/s390/net/qeth_sys.c b/drivers/s390/net/qeth_sys.c index f2a076a2b2f1..882d419e4160 100644 --- a/drivers/s390/net/qeth_sys.c +++ b/drivers/s390/net/qeth_sys.c | |||
@@ -1145,11 +1145,10 @@ qeth_dev_ipato_add_store(const char *buf, size_t count, | |||
1145 | if ((rc = qeth_parse_ipatoe(buf, proto, addr, &mask_bits))) | 1145 | if ((rc = qeth_parse_ipatoe(buf, proto, addr, &mask_bits))) |
1146 | return rc; | 1146 | return rc; |
1147 | 1147 | ||
1148 | if (!(ipatoe = kmalloc(sizeof(struct qeth_ipato_entry), GFP_KERNEL))){ | 1148 | if (!(ipatoe = kzalloc(sizeof(struct qeth_ipato_entry), GFP_KERNEL))){ |
1149 | PRINT_WARN("No memory to allocate ipato entry\n"); | 1149 | PRINT_WARN("No memory to allocate ipato entry\n"); |
1150 | return -ENOMEM; | 1150 | return -ENOMEM; |
1151 | } | 1151 | } |
1152 | memset(ipatoe, 0, sizeof(struct qeth_ipato_entry)); | ||
1153 | ipatoe->proto = proto; | 1152 | ipatoe->proto = proto; |
1154 | memcpy(ipatoe->addr, addr, (proto == QETH_PROT_IPV4)? 4:16); | 1153 | memcpy(ipatoe->addr, addr, (proto == QETH_PROT_IPV4)? 4:16); |
1155 | ipatoe->mask_bits = mask_bits; | 1154 | ipatoe->mask_bits = mask_bits; |
diff --git a/drivers/s390/s390_rdev.c b/drivers/s390/s390_rdev.c index e3f647169827..3c7145d9f9a1 100644 --- a/drivers/s390/s390_rdev.c +++ b/drivers/s390/s390_rdev.c | |||
@@ -27,10 +27,9 @@ s390_root_dev_register(const char *name) | |||
27 | 27 | ||
28 | if (!strlen(name)) | 28 | if (!strlen(name)) |
29 | return ERR_PTR(-EINVAL); | 29 | return ERR_PTR(-EINVAL); |
30 | dev = kmalloc(sizeof(struct device), GFP_KERNEL); | 30 | dev = kzalloc(sizeof(struct device), GFP_KERNEL); |
31 | if (!dev) | 31 | if (!dev) |
32 | return ERR_PTR(-ENOMEM); | 32 | return ERR_PTR(-ENOMEM); |
33 | memset(dev, 0, sizeof(struct device)); | ||
34 | strncpy(dev->bus_id, name, min(strlen(name), (size_t)BUS_ID_SIZE)); | 33 | strncpy(dev->bus_id, name, min(strlen(name), (size_t)BUS_ID_SIZE)); |
35 | dev->release = s390_root_dev_release; | 34 | dev->release = s390_root_dev_release; |
36 | ret = device_register(dev); | 35 | ret = device_register(dev); |