diff options
Diffstat (limited to 'drivers/s390/block/dasd.c')
-rw-r--r-- | drivers/s390/block/dasd.c | 12 |
1 files changed, 4 insertions, 8 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); |