Skip to contentSkip to conversation

zfcp: Replace kmalloc/memset with kzalloc

PATCH New Swen Schillig 1 participant 1 message Jun 14, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 zfcp: Replace kmalloc/memset with kzalloc

From: Swen Schillig <[email protected]>

Memory allocated with kmalloc is always initialzed to 0 with memset. Replace the two calls with kzalloc, that already does both steps.

---

 drivers/s390/scsi/zfcp_erp.c |    3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)
drivers/s390/scsi/zfcp_erp.c +1 -2
diff -urpN linux-2.6/drivers/s390/scsi/zfcp_erp.c linux-2.6-patched/drivers/s390/scsi/zfcp_erp.c
@@ -1626,7 +1626,7 @@ zfcp_erp_schedule_work(struct zfcp_unit 
 {
 	struct zfcp_erp_add_work *p;
 
-	p = kmalloc(sizeof(*p), GFP_KERNEL);
+	p = kzalloc(sizeof(*p), GFP_KERNEL);
 	if (!p) {
 		ZFCP_LOG_NORMAL("error: Out of resources. Could not register "
 				"the FCP-LUN 0x%Lx connected to "
@@ -1639,7 +1639,6 @@ zfcp_erp_schedule_work(struct zfcp_unit 
 	}
 
 	zfcp_unit_get(unit);
-	memset(p, 0, sizeof(*p));
 	atomic_set_mask(ZFCP_STATUS_UNIT_SCSI_WORK_PENDING, &unit->status);
 	INIT_WORK(&p->work, zfcp_erp_scsi_scan);
 	p->unit = unit;