diff options
author | Andreas Herrmann <aherrman@de.ibm.com> | 2006-05-22 12:17:30 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-05-28 12:42:52 -0400 |
commit | ec4081c6ba4fba6a8bc12a0e93db8817ba63ce47 (patch) | |
tree | 9aa5953a42fac103d216a08688bffe8f57029f8d | |
parent | ca3271b40225a1049334766f6fb35b57a0162bd2 (diff) |
[SCSI] zfcp: (cleanup) kmalloc/kzalloc replacement
Replace kmalloc/memset by kzalloc or kcalloc.
Signed-off-by: Andreas Herrmann <aherrman@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r-- | drivers/s390/scsi/zfcp_aux.c | 15 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_erp.c | 9 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_scsi.c | 6 |
3 files changed, 10 insertions, 20 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index 12bc8f2905c4..4a17ce499808 100644 --- a/drivers/s390/scsi/zfcp_aux.c +++ b/drivers/s390/scsi/zfcp_aux.c | |||
@@ -289,12 +289,11 @@ zfcp_cfdc_dev_ioctl(struct file *file, unsigned int command, | |||
289 | goto out; | 289 | goto out; |
290 | } | 290 | } |
291 | 291 | ||
292 | sg_list = kmalloc(sizeof(struct zfcp_sg_list), GFP_KERNEL); | 292 | sg_list = kzalloc(sizeof(struct zfcp_sg_list), GFP_KERNEL); |
293 | if (sg_list == NULL) { | 293 | if (sg_list == NULL) { |
294 | retval = -ENOMEM; | 294 | retval = -ENOMEM; |
295 | goto out; | 295 | goto out; |
296 | } | 296 | } |
297 | memset(sg_list, 0, sizeof(*sg_list)); | ||
298 | 297 | ||
299 | if (command != ZFCP_CFDC_IOC) { | 298 | if (command != ZFCP_CFDC_IOC) { |
300 | ZFCP_LOG_INFO("IOC request code 0x%x invalid\n", command); | 299 | ZFCP_LOG_INFO("IOC request code 0x%x invalid\n", command); |
@@ -476,14 +475,13 @@ zfcp_sg_list_alloc(struct zfcp_sg_list *sg_list, size_t size) | |||
476 | sg_list->count = size >> PAGE_SHIFT; | 475 | sg_list->count = size >> PAGE_SHIFT; |
477 | if (size & ~PAGE_MASK) | 476 | if (size & ~PAGE_MASK) |
478 | sg_list->count++; | 477 | sg_list->count++; |
479 | sg_list->sg = kmalloc(sg_list->count * sizeof(struct scatterlist), | 478 | sg_list->sg = kcalloc(sg_list->count, sizeof(struct scatterlist), |
480 | GFP_KERNEL); | 479 | GFP_KERNEL); |
481 | if (sg_list->sg == NULL) { | 480 | if (sg_list->sg == NULL) { |
482 | sg_list->count = 0; | 481 | sg_list->count = 0; |
483 | retval = -ENOMEM; | 482 | retval = -ENOMEM; |
484 | goto out; | 483 | goto out; |
485 | } | 484 | } |
486 | memset(sg_list->sg, 0, sg_list->count * sizeof(struct scatterlist)); | ||
487 | 485 | ||
488 | for (i = 0, sg = sg_list->sg; i < sg_list->count; i++, sg++) { | 486 | for (i = 0, sg = sg_list->sg; i < sg_list->count; i++, sg++) { |
489 | sg->length = min(size, PAGE_SIZE); | 487 | sg->length = min(size, PAGE_SIZE); |
@@ -756,10 +754,9 @@ zfcp_unit_enqueue(struct zfcp_port *port, fcp_lun_t fcp_lun) | |||
756 | if (unit) | 754 | if (unit) |
757 | return NULL; | 755 | return NULL; |
758 | 756 | ||
759 | unit = kmalloc(sizeof (struct zfcp_unit), GFP_KERNEL); | 757 | unit = kzalloc(sizeof (struct zfcp_unit), GFP_KERNEL); |
760 | if (!unit) | 758 | if (!unit) |
761 | return NULL; | 759 | return NULL; |
762 | memset(unit, 0, sizeof (struct zfcp_unit)); | ||
763 | 760 | ||
764 | /* initialise reference count stuff */ | 761 | /* initialise reference count stuff */ |
765 | atomic_set(&unit->refcount, 0); | 762 | atomic_set(&unit->refcount, 0); |
@@ -927,13 +924,12 @@ zfcp_adapter_enqueue(struct ccw_device *ccw_device) | |||
927 | */ | 924 | */ |
928 | 925 | ||
929 | /* try to allocate new adapter data structure (zeroed) */ | 926 | /* try to allocate new adapter data structure (zeroed) */ |
930 | adapter = kmalloc(sizeof (struct zfcp_adapter), GFP_KERNEL); | 927 | adapter = kzalloc(sizeof (struct zfcp_adapter), GFP_KERNEL); |
931 | if (!adapter) { | 928 | if (!adapter) { |
932 | ZFCP_LOG_INFO("error: allocation of base adapter " | 929 | ZFCP_LOG_INFO("error: allocation of base adapter " |
933 | "structure failed\n"); | 930 | "structure failed\n"); |
934 | goto out; | 931 | goto out; |
935 | } | 932 | } |
936 | memset(adapter, 0, sizeof (struct zfcp_adapter)); | ||
937 | 933 | ||
938 | ccw_device->handler = NULL; | 934 | ccw_device->handler = NULL; |
939 | 935 | ||
@@ -1137,10 +1133,9 @@ zfcp_port_enqueue(struct zfcp_adapter *adapter, wwn_t wwpn, u32 status, | |||
1137 | return NULL; | 1133 | return NULL; |
1138 | } | 1134 | } |
1139 | 1135 | ||
1140 | port = kmalloc(sizeof (struct zfcp_port), GFP_KERNEL); | 1136 | port = kzalloc(sizeof (struct zfcp_port), GFP_KERNEL); |
1141 | if (!port) | 1137 | if (!port) |
1142 | return NULL; | 1138 | return NULL; |
1143 | memset(port, 0, sizeof (struct zfcp_port)); | ||
1144 | 1139 | ||
1145 | /* initialise reference count stuff */ | 1140 | /* initialise reference count stuff */ |
1146 | atomic_set(&port->refcount, 0); | 1141 | atomic_set(&port->refcount, 0); |
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index f57440c96e27..ea2e7a398892 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c | |||
@@ -275,20 +275,17 @@ zfcp_erp_adisc(struct zfcp_port *port) | |||
275 | int retval = 0; | 275 | int retval = 0; |
276 | struct timer_list *timer; | 276 | struct timer_list *timer; |
277 | 277 | ||
278 | send_els = kmalloc(sizeof(struct zfcp_send_els), GFP_ATOMIC); | 278 | send_els = kzalloc(sizeof(struct zfcp_send_els), GFP_ATOMIC); |
279 | if (send_els == NULL) | 279 | if (send_els == NULL) |
280 | goto nomem; | 280 | goto nomem; |
281 | memset(send_els, 0, sizeof(*send_els)); | ||
282 | 281 | ||
283 | send_els->req = kmalloc(sizeof(struct scatterlist), GFP_ATOMIC); | 282 | send_els->req = kzalloc(sizeof(struct scatterlist), GFP_ATOMIC); |
284 | if (send_els->req == NULL) | 283 | if (send_els->req == NULL) |
285 | goto nomem; | 284 | goto nomem; |
286 | memset(send_els->req, 0, sizeof(*send_els->req)); | ||
287 | 285 | ||
288 | send_els->resp = kmalloc(sizeof(struct scatterlist), GFP_ATOMIC); | 286 | send_els->resp = kzalloc(sizeof(struct scatterlist), GFP_ATOMIC); |
289 | if (send_els->resp == NULL) | 287 | if (send_els->resp == NULL) |
290 | goto nomem; | 288 | goto nomem; |
291 | memset(send_els->resp, 0, sizeof(*send_els->resp)); | ||
292 | 289 | ||
293 | address = (void *) get_zeroed_page(GFP_ATOMIC); | 290 | address = (void *) get_zeroed_page(GFP_ATOMIC); |
294 | if (address == NULL) | 291 | if (address == NULL) |
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c index 118cf0fa0afc..3a180d80c3cb 100644 --- a/drivers/s390/scsi/zfcp_scsi.c +++ b/drivers/s390/scsi/zfcp_scsi.c | |||
@@ -761,10 +761,9 @@ zfcp_get_fc_host_stats(struct Scsi_Host *shost) | |||
761 | if (!fc_stats) | 761 | if (!fc_stats) |
762 | return NULL; | 762 | return NULL; |
763 | 763 | ||
764 | data = kmalloc(sizeof(*data), GFP_KERNEL); | 764 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
765 | if (!data) | 765 | if (!data) |
766 | return NULL; | 766 | return NULL; |
767 | memset(data, 0, sizeof(*data)); | ||
768 | 767 | ||
769 | ret = zfcp_fsf_exchange_port_data(NULL, adapter, data); | 768 | ret = zfcp_fsf_exchange_port_data(NULL, adapter, data); |
770 | if (ret) { | 769 | if (ret) { |
@@ -792,10 +791,9 @@ zfcp_reset_fc_host_stats(struct Scsi_Host *shost) | |||
792 | int ret; | 791 | int ret; |
793 | 792 | ||
794 | adapter = (struct zfcp_adapter *)shost->hostdata[0]; | 793 | adapter = (struct zfcp_adapter *)shost->hostdata[0]; |
795 | data = kmalloc(sizeof(*data), GFP_KERNEL); | 794 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
796 | if (!data) | 795 | if (!data) |
797 | return; | 796 | return; |
798 | memset(data, 0, sizeof(*data)); | ||
799 | 797 | ||
800 | ret = zfcp_fsf_exchange_port_data(NULL, adapter, data); | 798 | ret = zfcp_fsf_exchange_port_data(NULL, adapter, data); |
801 | if (ret == 0) { | 799 | if (ret == 0) { |