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/s390/block | |
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/s390/block')
-rw-r--r-- | drivers/s390/block/dasd.c | 12 | ||||
-rw-r--r-- | drivers/s390/block/dcssblk.c | 3 |
2 files changed, 5 insertions, 10 deletions
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index f32f7447588..dfe542b206c 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 44133250da2..be9b05347b4 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); |