diff options
author | Eric Sesterhenn <snakebyte@gmx.de> | 2006-03-24 14:15:31 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-24 18:33:18 +0300 |
commit | 88abaab4f9b08381e30e737980a1c49d6b524dfc (patch) | |
tree | d33aa82674c00c37cd293c9e888cff785880ce5a /drivers/s390/char | |
parent | fb630517f0d0736ea73af07d6b357be9ad67e6f1 (diff) | |
download | linux-88abaab4f9b08381e30e737980a1c49d6b524dfc.tar.xz |
[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.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 |
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) { struct fs3270 *fp; - fp = (struct fs3270 *) kmalloc(sizeof(struct fs3270),GFP_KERNEL); + fp = kzalloc(sizeof(struct fs3270),GFP_KERNEL); if (!fp) return ERR_PTR(-ENOMEM); - memset(fp, 0, sizeof(struct fs3270)); fp->init = raw3270_request_alloc(0); if (IS_ERR(fp->init)) { 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) { struct kbd_data *kbd; int i, len; - kbd = kmalloc(sizeof(struct kbd_data), GFP_KERNEL); + kbd = kzalloc(sizeof(struct kbd_data), GFP_KERNEL); if (!kbd) goto out; - memset(kbd, 0, sizeof(struct kbd_data)); - kbd->key_maps = kmalloc(sizeof(key_maps), GFP_KERNEL); + kbd->key_maps = kzalloc(sizeof(key_maps), GFP_KERNEL); if (!key_maps) goto out_kbd; - memset(kbd->key_maps, 0, sizeof(key_maps)); for (i = 0; i < ARRAY_SIZE(key_maps); i++) { if (key_maps[i]) { kbd->key_maps[i] = @@ -68,10 +66,9 @@ kbd_alloc(void) { sizeof(u_short)*NR_KEYS); } } - kbd->func_table = kmalloc(sizeof(func_table), GFP_KERNEL); + kbd->func_table = kzalloc(sizeof(func_table), GFP_KERNEL); if (!kbd->func_table) goto out_maps; - memset(kbd->func_table, 0, sizeof(func_table)); for (i = 0; i < ARRAY_SIZE(func_table); i++) { if (func_table[i]) { len = strlen(func_table[i]) + 1; @@ -82,10 +79,9 @@ kbd_alloc(void) { } } kbd->fn_handler = - kmalloc(sizeof(fn_handler_fn *) * NR_FN_HANDLER, GFP_KERNEL); + kzalloc(sizeof(fn_handler_fn *) * NR_FN_HANDLER, GFP_KERNEL); if (!kbd->fn_handler) goto out_func; - memset(kbd->fn_handler, 0, sizeof(fn_handler_fn *) * NR_FN_HANDLER); kbd->accent_table = kmalloc(sizeof(struct kbdiacr)*MAX_DIACR, GFP_KERNEL); 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) int i,j; struct mon_private *monpriv; - monpriv = kmalloc(sizeof(struct mon_private), GFP_KERNEL); + monpriv = kzalloc(sizeof(struct mon_private), GFP_KERNEL); if (!monpriv) { P_ERROR("no memory for monpriv\n"); return NULL; } - memset(monpriv, 0, sizeof(struct mon_private)); for (i = 0; i < MON_MSGLIM; i++) { - monpriv->msg_array[i] = kmalloc(sizeof(struct mon_msg), + monpriv->msg_array[i] = kzalloc(sizeof(struct mon_msg), GFP_KERNEL); if (!monpriv->msg_array[i]) { P_ERROR("open, no memory for msg_array\n"); @@ -272,7 +271,6 @@ mon_alloc_mem(void) kfree(monpriv->msg_array[j]); return NULL; } - memset(monpriv->msg_array[i], 0, sizeof(struct mon_msg)); } return monpriv; } 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) struct raw3270_request *rq; /* Allocate request structure */ - rq = kmalloc(sizeof(struct raw3270_request), GFP_KERNEL | GFP_DMA); + rq = kzalloc(sizeof(struct raw3270_request), GFP_KERNEL | GFP_DMA); if (!rq) return ERR_PTR(-ENOMEM); - memset(rq, 0, sizeof(struct raw3270_request)); /* alloc output buffer. */ 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( int rc; char * s; - tcd = kmalloc(sizeof(struct tape_class_device), GFP_KERNEL); + tcd = kzalloc(sizeof(struct tape_class_device), GFP_KERNEL); if (!tcd) return ERR_PTR(-ENOMEM); - memset(tcd, 0, sizeof(struct tape_class_device)); strncpy(tcd->device_name, device_name, TAPECLASS_NAME_LEN); for (s = strchr(tcd->device_name, '/'); s; s = strchr(s, '/')) *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) { struct tape_device *device; - device = (struct tape_device *) - kmalloc(sizeof(struct tape_device), GFP_KERNEL); + device = kzalloc(sizeof(struct tape_device), GFP_KERNEL); if (device == NULL) { DBF_EXCEPTION(2, "ti:no mem\n"); PRINT_INFO ("can't allocate memory for " "tape info structure\n"); return ERR_PTR(-ENOMEM); } - memset(device, 0, sizeof(struct tape_device)); - device->modeset_byte = (char *) kmalloc(1, GFP_KERNEL | GFP_DMA); + device->modeset_byte = kmalloc(1, GFP_KERNEL | GFP_DMA); if (device->modeset_byte == NULL) { DBF_EXCEPTION(2, "ti:no mem\n"); PRINT_INFO("can't allocate memory for modeset byte\n"); @@ -659,34 +657,30 @@ tape_alloc_request(int cplength, int datasize) DBF_LH(6, "tape_alloc_request(%d, %d)\n", cplength, datasize); - request = (struct tape_request *) kmalloc(sizeof(struct tape_request), - GFP_KERNEL); + request = kzalloc(sizeof(struct tape_request), GFP_KERNEL); if (request == NULL) { DBF_EXCEPTION(1, "cqra nomem\n"); return ERR_PTR(-ENOMEM); } - memset(request, 0, sizeof(struct tape_request)); /* allocate channel program */ if (cplength > 0) { - request->cpaddr = kmalloc(cplength*sizeof(struct ccw1), + request->cpaddr = kcalloc(cplength, sizeof(struct ccw1), GFP_ATOMIC | GFP_DMA); if (request->cpaddr == NULL) { DBF_EXCEPTION(1, "cqra nomem\n"); kfree(request); return ERR_PTR(-ENOMEM); } - memset(request->cpaddr, 0, cplength*sizeof(struct ccw1)); } /* alloc small kernel buffer */ if (datasize > 0) { - request->cpdata = kmalloc(datasize, GFP_KERNEL | GFP_DMA); + request->cpdata = kzalloc(datasize, GFP_KERNEL | GFP_DMA); if (request->cpdata == NULL) { DBF_EXCEPTION(1, "cqra nomem\n"); kfree(request->cpaddr); kfree(request); return ERR_PTR(-ENOMEM); } - memset(request->cpdata, 0, datasize); } DBF_LH(6, "New request %p(%p/%p)\n", request, request->cpaddr, 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) struct tty3270 *tp; int pages; - tp = kmalloc(sizeof(struct tty3270),GFP_KERNEL); + tp = kzalloc(sizeof(struct tty3270), GFP_KERNEL); if (!tp) goto out_err; - memset(tp, 0, sizeof(struct tty3270)); tp->freemem_pages = kmalloc(sizeof(void *) * TTY3270_STRING_PAGES, GFP_KERNEL); if (!tp->freemem_pages) @@ -767,16 +766,14 @@ tty3270_alloc_screen(struct tty3270 *tp) int lines; size = sizeof(struct tty3270_line) * (tp->view.rows - 2); - tp->screen = kmalloc(size, GFP_KERNEL); + tp->screen = kzalloc(size, GFP_KERNEL); if (!tp->screen) goto out_err; - memset(tp->screen, 0, size); for (lines = 0; lines < tp->view.rows - 2; lines++) { size = sizeof(struct tty3270_cell) * tp->view.cols; - tp->screen[lines].cells = kmalloc(size, GFP_KERNEL); + tp->screen[lines].cells = kzalloc(size, GFP_KERNEL); if (!tp->screen[lines].cells) goto out_screen; - memset(tp->screen[lines].cells, 0, size); } return 0; 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) { struct device *dev; int ret; - dev = kmalloc(sizeof(struct device), GFP_KERNEL); + dev = kzalloc(sizeof(struct device), GFP_KERNEL); if (dev) { - memset(dev, 0, sizeof(struct device)); snprintf(dev->bus_id, BUS_ID_SIZE, "%s", priv->internal_name); dev->bus = &iucv_bus; |