diff mbox

[OPW,kernel] staging:unisys: use kzalloc instead of kmalloc and memset

Message ID 20140317101144.GA7474@himangi-Inspiron-N5110gmail.com
State New, archived
Headers show

Commit Message

HIMANGI SARAOGI March 17, 2014, 10:11 a.m. UTC
Use kzalloc rather than kmalloc followed by memset with 0.
Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
---
 .../unisys/visorchipset/visorchipset_main.c        |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Greg Kroah-Hartman March 18, 2014, 7:05 p.m. UTC | #1
On Mon, Mar 17, 2014 at 03:41:45PM +0530, Himangi Saraogi wrote:
> Use kzalloc rather than kmalloc followed by memset with 0.
> Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
> 
> Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
> ---
>  .../unisys/visorchipset/visorchipset_main.c        |    6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

Patch does not apply to my tree can you refresh it and resend?

thanks,

greg k-h
diff mbox

Patch

diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c
index 400cb03..6bfabf9 100644
--- a/drivers/staging/unisys/visorchipset/visorchipset_main.c
+++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c
@@ -1081,7 +1081,7 @@  bus_create(CONTROLVM_MESSAGE *inmsg)
 				 POSTCODE_SEVERITY_ERR);
 		RETINT(-CONTROLVM_RESP_ERROR_ALREADY_DONE);
 	}
-	pBusInfo = kmalloc(sizeof(VISORCHIPSET_BUS_INFO), GFP_KERNEL);
+	pBusInfo = kzalloc(sizeof(VISORCHIPSET_BUS_INFO), GFP_KERNEL);
 	if (pBusInfo == NULL) {
 		LOGERR("CONTROLVM_BUS_CREATE Failed: bus %lu kmalloc failed",
 		       busNo);
@@ -1090,7 +1090,6 @@  bus_create(CONTROLVM_MESSAGE *inmsg)
 		RETINT(-CONTROLVM_RESP_ERROR_KMALLOC_FAILED);
 	}
 
-	memset(pBusInfo, 0, sizeof(VISORCHIPSET_BUS_INFO));
 	INIT_LIST_HEAD(&pBusInfo->entry);
 	pBusInfo->busNo = busNo;
 	pBusInfo->devNo = cmd->createBus.deviceCount;
@@ -1231,7 +1230,7 @@  my_device_create(CONTROLVM_MESSAGE *inmsg)
 				 POSTCODE_SEVERITY_ERR);
 		RETINT(-CONTROLVM_RESP_ERROR_BUS_INVALID);
 	}
-	pDevInfo = kmalloc(sizeof(VISORCHIPSET_DEVICE_INFO), GFP_KERNEL);
+	pDevInfo = kzalloc(sizeof(VISORCHIPSET_DEVICE_INFO), GFP_KERNEL);
 	if (pDevInfo == NULL) {
 		LOGERR("CONTROLVM_DEVICE_CREATE Failed: busNo=%lu, devNo=%lu kmaloc failed",
 		     busNo, devNo);
@@ -1239,7 +1238,6 @@  my_device_create(CONTROLVM_MESSAGE *inmsg)
 				 POSTCODE_SEVERITY_ERR);
 		RETINT(-CONTROLVM_RESP_ERROR_KMALLOC_FAILED);
 	}
-	memset(pDevInfo, 0, sizeof(VISORCHIPSET_DEVICE_INFO));
 	INIT_LIST_HEAD(&pDevInfo->entry);
 	pDevInfo->busNo = busNo;
 	pDevInfo->devNo = devNo;