diff options
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 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); |