aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_aux.c
diff options
context:
space:
mode:
authorAndreas Herrmann <aherrman@de.ibm.com>2006-05-22 12:17:30 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-05-28 12:42:52 -0400
commitec4081c6ba4fba6a8bc12a0e93db8817ba63ce47 (patch)
tree9aa5953a42fac103d216a08688bffe8f57029f8d /drivers/s390/scsi/zfcp_aux.c
parentca3271b40225a1049334766f6fb35b57a0162bd2 (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>
Diffstat (limited to 'drivers/s390/scsi/zfcp_aux.c')
-rw-r--r--drivers/s390/scsi/zfcp_aux.c15
1 files changed, 5 insertions, 10 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);