Commit b156f1ed authored by Shraddha Barke's avatar Shraddha Barke Committed by Greg Kroah-Hartman

Staging: wilc1000: Use kzalloc instead of kmalloc and memset

Replace kmalloc and memset with a single call to kzalloc.
Signed-off-by: default avatarShraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8c6c463e
...@@ -1867,15 +1867,13 @@ static int Handle_Key(struct host_if_drv *hif_drv, ...@@ -1867,15 +1867,13 @@ static int Handle_Key(struct host_if_drv *hif_drv,
case WPARxGtk: case WPARxGtk:
if (pstrHostIFkeyAttr->action & ADDKEY_AP) { if (pstrHostIFkeyAttr->action & ADDKEY_AP) {
pu8keybuf = kmalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
if (pu8keybuf == NULL) { if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send RxGTK Key\n"); PRINT_ER("No buffer to send RxGTK Key\n");
ret = -1; ret = -1;
goto _WPARxGtk_end_case_; goto _WPARxGtk_end_case_;
} }
memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN);
if (pstrHostIFkeyAttr->attr.wpa.seq != NULL) if (pstrHostIFkeyAttr->attr.wpa.seq != NULL)
memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->attr.wpa.seq, 8); memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->attr.wpa.seq, 8);
...@@ -1904,15 +1902,13 @@ static int Handle_Key(struct host_if_drv *hif_drv, ...@@ -1904,15 +1902,13 @@ static int Handle_Key(struct host_if_drv *hif_drv,
if (pstrHostIFkeyAttr->action & ADDKEY) { if (pstrHostIFkeyAttr->action & ADDKEY) {
PRINT_D(HOSTINF_DBG, "Handling group key(Rx) function\n"); PRINT_D(HOSTINF_DBG, "Handling group key(Rx) function\n");
pu8keybuf = kmalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
if (pu8keybuf == NULL) { if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send RxGTK Key\n"); PRINT_ER("No buffer to send RxGTK Key\n");
ret = -1; ret = -1;
goto _WPARxGtk_end_case_; goto _WPARxGtk_end_case_;
} }
memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN);
if (hif_drv->enuHostIFstate == HOST_IF_CONNECTED) if (hif_drv->enuHostIFstate == HOST_IF_CONNECTED)
memcpy(pu8keybuf, hif_drv->au8AssociatedBSSID, ETH_ALEN); memcpy(pu8keybuf, hif_drv->au8AssociatedBSSID, ETH_ALEN);
else else
...@@ -4936,9 +4932,8 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) ...@@ -4936,9 +4932,8 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo)
pu8IEs = ptstrNetworkInfo->pu8IEs; pu8IEs = ptstrNetworkInfo->pu8IEs;
u16IEsLen = ptstrNetworkInfo->u16IEsLen; u16IEsLen = ptstrNetworkInfo->u16IEsLen;
pNewJoinBssParam = kmalloc(sizeof(struct join_bss_param), GFP_KERNEL); pNewJoinBssParam = kzalloc(sizeof(struct join_bss_param), GFP_KERNEL);
if (pNewJoinBssParam != NULL) { if (pNewJoinBssParam != NULL) {
memset(pNewJoinBssParam, 0, sizeof(struct join_bss_param));
pNewJoinBssParam->dtim_period = ptstrNetworkInfo->u8DtimPeriod; pNewJoinBssParam->dtim_period = ptstrNetworkInfo->u8DtimPeriod;
pNewJoinBssParam->beacon_period = ptstrNetworkInfo->u16BeaconPeriod; pNewJoinBssParam->beacon_period = ptstrNetworkInfo->u16BeaconPeriod;
pNewJoinBssParam->cap_info = ptstrNetworkInfo->u16CapInfo; pNewJoinBssParam->cap_info = ptstrNetworkInfo->u16CapInfo;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment