staging: wilc1000: coreconfigurator.c: use kmalloc instead of WILC_MALLOC
[deliverable/linux.git] / drivers / staging / wilc1000 / coreconfigurator.c
index 1a5b16577fd506d89ae5f2b4b6606cf4b266359b..fd899140b16f6b4a96336a8128a638168db43fab 100644 (file)
@@ -167,7 +167,6 @@ extern void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length);
 static struct semaphore SemHandleSendPkt;
 static struct semaphore SemHandlePktResp;
 
-static s8 *gps8ConfigPacket;
 
 static tstrConfigPktInfo gstrConfigPktInfo;
 
@@ -674,17 +673,8 @@ s32 CoreConfiguratorInit(void)
        sema_init(&SemHandleSendPkt, 1);
        sema_init(&SemHandlePktResp, 0);
 
-       gps8ConfigPacket = (s8 *)WILC_MALLOC(MAX_PACKET_BUFF_SIZE);
-       if (gps8ConfigPacket == NULL) {
-               PRINT_ER("failed in gps8ConfigPacket allocation\n");
-               s32Error = WILC_NO_MEM;
-               goto _fail_;
-       }
-
-       memset((void *)gps8ConfigPacket, 0, MAX_PACKET_BUFF_SIZE);
 
        memset((void *)(&gstrConfigPktInfo), 0, sizeof(tstrConfigPktInfo));
-_fail_:
        return s32Error;
 }
 
@@ -810,7 +800,7 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
                u32 u32Tsf_Lo;
                u32 u32Tsf_Hi;
 
-               pstrNetworkInfo = (tstrNetworkInfo *)WILC_MALLOC(sizeof(tstrNetworkInfo));
+               pstrNetworkInfo = kmalloc(sizeof(tstrNetworkInfo), GFP_KERNEL);
                memset((void *)(pstrNetworkInfo), 0, sizeof(tstrNetworkInfo));
 
                pstrNetworkInfo->s8rssi = pu8WidVal[0];
@@ -860,7 +850,7 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
                u16IEsLen = u16RxLen - (MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN);
 
                if (u16IEsLen > 0) {
-                       pstrNetworkInfo->pu8IEs = (u8 *)WILC_MALLOC(u16IEsLen);
+                       pstrNetworkInfo->pu8IEs = kmalloc(u16IEsLen, GFP_KERNEL);
                        memset((void *)(pstrNetworkInfo->pu8IEs), 0, u16IEsLen);
 
                        memcpy(pstrNetworkInfo->pu8IEs, pu8IEs, u16IEsLen);
@@ -927,7 +917,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
        u8 *pu8IEs = 0;
        u16 u16IEsLen = 0;
 
-       pstrConnectRespInfo = (tstrConnectRespInfo *)WILC_MALLOC(sizeof(tstrConnectRespInfo));
+       pstrConnectRespInfo = kmalloc(sizeof(tstrConnectRespInfo), GFP_KERNEL);
        memset((void *)(pstrConnectRespInfo), 0, sizeof(tstrConnectRespInfo));
 
        /* u16AssocRespLen = pu8Buffer[0]; */
@@ -947,7 +937,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
                pu8IEs = &pu8Buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
                u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN);
 
-               pstrConnectRespInfo->pu8RespIEs = (u8 *)WILC_MALLOC(u16IEsLen);
+               pstrConnectRespInfo->pu8RespIEs = kmalloc(u16IEsLen, GFP_KERNEL);
                memset((void *)(pstrConnectRespInfo->pu8RespIEs), 0, u16IEsLen);
 
                memcpy(pstrConnectRespInfo->pu8RespIEs, pu8IEs, u16IEsLen);
@@ -1016,7 +1006,8 @@ s32 ParseSurveyResults(u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZ
                }
        }
 
-       pstrSurveyResults = (wid_site_survey_reslts_s *)WILC_MALLOC(u32SurveyResultsCount * sizeof(wid_site_survey_reslts_s));
+       pstrSurveyResults = kmalloc_array(u32SurveyResultsCount,
+                               sizeof(wid_site_survey_reslts_s), GFP_KERNEL);
        if (pstrSurveyResults == NULL) {
                u32SurveyResultsCount = 0;
                WILC_ERRORREPORT(s32Error, WILC_NO_MEM);
@@ -1954,11 +1945,6 @@ s32 CoreConfiguratorDeInit(void)
 
        PRINT_D(CORECONFIG_DBG, "CoreConfiguratorDeInit()\n");
 
-       if (gps8ConfigPacket != NULL) {
-
-               kfree(gps8ConfigPacket);
-               gps8ConfigPacket = NULL;
-       }
 
        return s32Error;
 }
This page took 0.027264 seconds and 5 git commands to generate.