aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/char
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/char
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/char')
-rw-r--r--drivers/s390/char/fs3270.c3
-rw-r--r--drivers/s390/char/keyboard.c12
-rw-r--r--drivers/s390/char/monreader.c6
-rw-r--r--drivers/s390/char/raw3270.c3
-rw-r--r--drivers/s390/char/tape_class.c3
-rw-r--r--drivers/s390/char/tape_core.c16
-rw-r--r--drivers/s390/char/tty3270.c9
-rw-r--r--drivers/s390/char/vmlogrdr.c3
8 files changed, 18 insertions, 37 deletions
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;
782out_screen: 779out_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;