diff options
author | Andreea-Cristina Bernat <bernat.ada@gmail.com> | 2014-03-14 04:20:06 +0200 |
---|---|---|
committer | Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> | 2014-03-16 18:20:10 -0700 |
commit | 97a84f1203786985856a0d4b49b1d7cc387238ce (patch) | |
tree | 6b91e1c45a759039f1ba4c1a7ba9885744e4e31d /drivers/staging/unisys/visorchipset | |
parent | ac0ba3f8e46182ebc6b57922f348de62d01fa4e1 (diff) |
Staging: unisys: Replace kmalloc/memset with kzalloc
This patch solves the Coccinelle warning: "kzalloc should be used instead of
kmalloc/memset".
Signed-off-by: Andreea-Cristina Bernat <bernat.ada@gmail.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Diffstat (limited to 'drivers/staging/unisys/visorchipset')
-rw-r--r-- | drivers/staging/unisys/visorchipset/parser.c | 4 | ||||
-rw-r--r-- | drivers/staging/unisys/visorchipset/visorchipset_main.c | 9 |
2 files changed, 6 insertions, 7 deletions
diff --git a/drivers/staging/unisys/visorchipset/parser.c b/drivers/staging/unisys/visorchipset/parser.c index f52c407437c9..de0a4c23ffaf 100644 --- a/drivers/staging/unisys/visorchipset/parser.c +++ b/drivers/staging/unisys/visorchipset/parser.c @@ -65,7 +65,7 @@ parser_init_guts(U64 addr, U32 bytes, BOOL isLocal, *tryAgain = TRUE; RETPTR(NULL); } - ctx = kmalloc(allocbytes, GFP_KERNEL|__GFP_NORETRY); + ctx = kzalloc(allocbytes, GFP_KERNEL|__GFP_NORETRY); if (ctx == NULL) { ERRDRV("%s (%s:%d) - failed to allocate %d bytes", __func__, __FILE__, __LINE__, allocbytes); @@ -73,7 +73,7 @@ parser_init_guts(U64 addr, U32 bytes, BOOL isLocal, *tryAgain = TRUE; RETPTR(NULL); } - memset(ctx, 0, allocbytes); + ctx->allocbytes = allocbytes; ctx->param_bytes = bytes; ctx->curr = NULL; diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 400cb035a016..2a9e30cdebe0 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -1081,16 +1081,15 @@ 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", + LOGERR("CONTROLVM_BUS_CREATE Failed: bus %lu kzalloc failed", busNo); POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, busNo, POSTCODE_SEVERITY_ERR); 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,7 @@ 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; |