From 24391e61f47cc35f36c1f54be48e038337b46490 Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Sat, 13 Dec 2014 09:08:01 -0600 Subject: [PATCH] rtl8188eu: Remove wrapper around some kzalloc() calls Signed-off-by: Larry Finger --- core/rtw_cmd.c | 140 ++++++++++++++++++++++++++----------------------- 1 file changed, 74 insertions(+), 66 deletions(-) diff --git a/core/rtw_cmd.c b/core/rtw_cmd.c index 25be3be..aaf76df 100644 --- a/core/rtw_cmd.c +++ b/core/rtw_cmd.c @@ -46,7 +46,8 @@ int _rtw_init_cmd_priv (struct cmd_priv *pcmdpriv) pcmdpriv->cmd_seq = 1; - pcmdpriv->cmd_allocated_buf = rtw_zmalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ); + pcmdpriv->cmd_allocated_buf = kzalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ, + GFP_KERNEL); if (pcmdpriv->cmd_allocated_buf == NULL) { res = _FAIL; @@ -55,7 +56,7 @@ int _rtw_init_cmd_priv (struct cmd_priv *pcmdpriv) pcmdpriv->cmd_buf = pcmdpriv->cmd_allocated_buf + CMDBUFF_ALIGN_SZ - ((size_t)(pcmdpriv->cmd_allocated_buf) & (CMDBUFF_ALIGN_SZ-1)); - pcmdpriv->rsp_allocated_buf = rtw_zmalloc(MAX_RSPSZ + 4); + pcmdpriv->rsp_allocated_buf = kzalloc(MAX_RSPSZ + 4, GFP_KERNEL); if (pcmdpriv->rsp_allocated_buf == NULL) { res = _FAIL; @@ -396,13 +397,13 @@ u8 rtw_setstandby_cmd(struct adapter *padapter, uint action) u8 ret = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (ph2c == NULL) { ret = _FAIL; goto exit; } - psetusbsuspend = (struct usb_suspend_parm *)rtw_zmalloc(sizeof(struct usb_suspend_parm)); + psetusbsuspend = kzalloc(sizeof(struct usb_suspend_parm), GFP_ATOMIC); if (psetusbsuspend == NULL) { kfree(ph2c); ret = _FAIL; @@ -442,11 +443,11 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, p2p_ps_wk_cmd(padapter, P2P_PS_SCAN, 1); } - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (ph2c == NULL) return _FAIL; - psurveyPara = (struct sitesurvey_parm *)rtw_zmalloc(sizeof(struct sitesurvey_parm)); + psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_ATOMIC); if (psurveyPara == NULL) { kfree(ph2c); return _FAIL; @@ -515,13 +516,13 @@ u8 rtw_setdatarate_cmd(struct adapter *padapter, u8 *rateset) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (ph2c == NULL) { res = _FAIL; goto exit; } - pbsetdataratepara = (struct setdatarate_parm *)rtw_zmalloc(sizeof(struct setdatarate_parm)); + pbsetdataratepara = kzalloc(sizeof(struct setdatarate_parm), GFP_ATOMIC); if (pbsetdataratepara == NULL) { kfree(ph2c); res = _FAIL; @@ -544,12 +545,12 @@ u8 rtw_setbasicrate_cmd(struct adapter *padapter, u8 *rateset) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (ph2c == NULL) { res = _FAIL; goto exit; } - pssetbasicratepara = (struct setbasicrate_parm *)rtw_zmalloc(sizeof(struct setbasicrate_parm)); + pssetbasicratepara = kzalloc(sizeof(struct setbasicrate_parm), GFP_ATOMIC); if (pssetbasicratepara == NULL) { kfree(ph2c); @@ -581,12 +582,12 @@ u8 rtw_setphy_cmd(struct adapter *padapter, u8 modem, u8 ch) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (ph2c == NULL) { res = _FAIL; goto exit; } - psetphypara = (struct setphy_parm *)rtw_zmalloc(sizeof(struct setphy_parm)); + psetphypara = kzalloc(sizeof(struct setphy_parm), GFP_ATOMIC); if (psetphypara == NULL) { kfree(ph2c); @@ -614,12 +615,12 @@ u8 rtw_setbbreg_cmd(struct adapter *padapter, u8 offset, u8 val) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (ph2c == NULL) { res = _FAIL; goto exit; } - pwritebbparm = (struct writeBB_parm *)rtw_zmalloc(sizeof(struct writeBB_parm)); + pwritebbparm = kzalloc(sizeof(struct writeBB_parm), GFP_ATOMIC); if (pwritebbparm == NULL) { kfree(ph2c); @@ -645,12 +646,12 @@ u8 rtw_getbbreg_cmd(struct adapter *padapter, u8 offset, u8 *pval) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (ph2c == NULL) { res = _FAIL; goto exit; } - prdbbparm = (struct readBB_parm *)rtw_zmalloc(sizeof(struct readBB_parm)); + prdbbparm = kzalloc(sizeof(struct readBB_parm), GFP_ATOMIC); if (prdbbparm == NULL) { kfree(ph2c); @@ -679,12 +680,12 @@ u8 rtw_setrfreg_cmd(struct adapter *padapter, u8 offset, u32 val) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (ph2c == NULL) { res = _FAIL; goto exit; } - pwriterfparm = (struct writeRF_parm *)rtw_zmalloc(sizeof(struct writeRF_parm)); + pwriterfparm = kzalloc(sizeof(struct writeRF_parm), GFP_ATOMIC); if (pwriterfparm == NULL) { kfree(ph2c); @@ -710,13 +711,13 @@ u8 rtw_getrfreg_cmd(struct adapter *padapter, u8 offset, u8 *pval) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (ph2c == NULL) { res = _FAIL; goto exit; } - prdrfparm = (struct readRF_parm *)rtw_zmalloc(sizeof(struct readRF_parm)); + prdrfparm = kzalloc(sizeof(struct readRF_parm), GFP_ATOMIC); if (prdrfparm == NULL) { kfree(ph2c); res = _FAIL; @@ -778,7 +779,7 @@ u8 rtw_createbss_cmd(struct adapter *padapter) else RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, (" createbss for SSid:%s\n", pmlmepriv->assoc_ssid.Ssid)); - pcmd = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + pcmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); if (pcmd == NULL) { res = _FAIL; goto exit; @@ -803,7 +804,7 @@ u8 rtw_createbss_cmd_ex(struct adapter *padapter, unsigned char *pbss, unsigned struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - pcmd = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + pcmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (pcmd == NULL) { res = _FAIL; goto exit; @@ -847,7 +848,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+Join cmd: SSid =[%s]\n", pmlmepriv->assoc_ssid.Ssid)); } - pcmd = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + pcmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (pcmd == NULL) { res = _FAIL; RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("rtw_joinbss_cmd: memory allocate for cmd_obj fail!!!\n")); @@ -970,7 +971,7 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueu RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_disassoc_cmd\n")); /* prepare cmd parameter */ - param = (struct disconnect_parm *)rtw_zmalloc(sizeof(*param)); + param = kzalloc(sizeof(*param), GFP_KERNEL); if (param == NULL) { res = _FAIL; goto exit; @@ -979,7 +980,7 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueu if (enqueue) { /* need enqueue, prepare cmd_obj and enqueue */ - cmdobj = (struct cmd_obj *)rtw_zmalloc(sizeof(*cmdobj)); + cmdobj = kzalloc(sizeof(*cmdobj), GFP_KERNEL); if (cmdobj == NULL) { res = _FAIL; kfree(param); @@ -1007,12 +1008,12 @@ u8 rtw_setopmode_cmd(struct adapter *padapter, enum ndis_802_11_network_infra n struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); if (ph2c == NULL) { res = false; goto exit; } - psetop = (struct setopmode_parm *)rtw_zmalloc(sizeof(struct setopmode_parm)); + psetop = kzalloc(sizeof(struct setopmode_parm), GFP_KERNEL); if (psetop == NULL) { kfree(ph2c); @@ -1042,20 +1043,20 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, u8 *psta, u8 unicast_key) struct sta_info *sta = (struct sta_info *)psta; u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); if (ph2c == NULL) { res = _FAIL; goto exit; } - psetstakey_para = (struct set_stakey_parm *)rtw_zmalloc(sizeof(struct set_stakey_parm)); + psetstakey_para = kzalloc(sizeof(struct set_stakey_parm), GFP_KERNEL); if (psetstakey_para == NULL) { kfree(ph2c); res = _FAIL; goto exit; } - psetstakey_rsp = (struct set_stakey_rsp *)rtw_zmalloc(sizeof(struct set_stakey_rsp)); + psetstakey_rsp = kzalloc(sizeof(struct set_stakey_rsp), GFP_KERNEL); if (psetstakey_rsp == NULL) { kfree(ph2c); kfree(psetstakey_para); @@ -1101,20 +1102,22 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, u8 *psta, u8 entry, u8 enqueue) if (!enqueue) { clear_cam_entry(padapter, entry); } else { - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (ph2c == NULL) { res = _FAIL; goto exit; } - psetstakey_para = (struct set_stakey_parm *)rtw_zmalloc(sizeof(struct set_stakey_parm)); + psetstakey_para = kzalloc(sizeof(struct set_stakey_parm), + GFP_ATOMIC); if (psetstakey_para == NULL) { kfree(ph2c); res = _FAIL; goto exit; } - psetstakey_rsp = (struct set_stakey_rsp *)rtw_zmalloc(sizeof(struct set_stakey_rsp)); + psetstakey_rsp = kzalloc(sizeof(struct set_stakey_rsp), + GFP_ATOMIC); if (psetstakey_rsp == NULL) { kfree(ph2c); kfree(psetstakey_para); @@ -1146,12 +1149,12 @@ u8 rtw_setrttbl_cmd(struct adapter *padapter, struct setratable_parm *prate_tab struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); if (ph2c == NULL) { res = _FAIL; goto exit; } - psetrttblparm = (struct setratable_parm *)rtw_zmalloc(sizeof(struct setratable_parm)); + psetrttblparm = kzalloc(sizeof(struct setratable_parm), GFP_KERNEL); if (psetrttblparm == NULL) { kfree(ph2c); @@ -1176,12 +1179,12 @@ u8 rtw_getrttbl_cmd(struct adapter *padapter, struct getratable_rsp *pval) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); if (ph2c == NULL) { res = _FAIL; goto exit; } - pgetrttblparm = (struct getratable_parm *)rtw_zmalloc(sizeof(struct getratable_parm)); + pgetrttblparm = kzalloc(sizeof(struct getratable_parm), GFP_KERNEL); if (pgetrttblparm == NULL) { kfree(ph2c); @@ -1215,20 +1218,20 @@ u8 rtw_setassocsta_cmd(struct adapter *padapter, u8 *mac_addr) u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (ph2c == NULL) { res = _FAIL; goto exit; } - psetassocsta_para = (struct set_assocsta_parm *)rtw_zmalloc(sizeof(struct set_assocsta_parm)); + psetassocsta_para = kzalloc(sizeof(struct set_assocsta_parm), GFP_ATOMIC); if (psetassocsta_para == NULL) { kfree(ph2c); res = _FAIL; goto exit; } - psetassocsta_rsp = (struct set_stakey_rsp *)rtw_zmalloc(sizeof(struct set_assocsta_rsp)); + psetassocsta_rsp = kzalloc(sizeof(struct set_assocsta_rsp), GFP_ATOMIC); if (psetassocsta_rsp == NULL) { kfree(ph2c); kfree(psetassocsta_para); @@ -1255,13 +1258,13 @@ u8 rtw_addbareq_cmd(struct adapter *padapter, u8 tid, u8 *addr) struct addBaReq_parm *paddbareq_parm; u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); if (ph2c == NULL) { res = _FAIL; goto exit; } - paddbareq_parm = (struct addBaReq_parm *)rtw_zmalloc(sizeof(struct addBaReq_parm)); + paddbareq_parm = kzalloc(sizeof(struct addBaReq_parm), GFP_KERNEL); if (paddbareq_parm == NULL) { kfree(ph2c); res = _FAIL; @@ -1290,13 +1293,13 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter *padapter) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (ph2c == NULL) { res = _FAIL; goto exit; } - pdrvextra_cmd_parm = (struct drvextra_cmd_parm *)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); + pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); if (pdrvextra_cmd_parm == NULL) { kfree(ph2c); res = _FAIL; @@ -1330,7 +1333,7 @@ u8 rtw_set_ch_cmd(struct adapter *padapter, u8 ch, u8 bw, u8 ch_offset, u8 enque /* check input parameter */ /* prepare cmd parameter */ - set_ch_parm = (struct set_ch_parm *)rtw_zmalloc(sizeof(*set_ch_parm)); + set_ch_parm = kzalloc(sizeof(*set_ch_parm), GFP_ATOMIC); if (set_ch_parm == NULL) { res = _FAIL; goto exit; @@ -1341,7 +1344,7 @@ u8 rtw_set_ch_cmd(struct adapter *padapter, u8 ch, u8 bw, u8 ch_offset, u8 enque if (enqueue) { /* need enqueue, prepare cmd_obj and enqueue */ - pcmdobj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + pcmdobj = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (pcmdobj == NULL) { kfree(set_ch_parm); res = _FAIL; @@ -1384,7 +1387,8 @@ u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan, u8 enqueue) } /* prepare cmd parameter */ - setChannelPlan_param = (struct SetChannelPlan_param *)rtw_zmalloc(sizeof(struct SetChannelPlan_param)); + setChannelPlan_param = kzalloc(sizeof(struct SetChannelPlan_param), + GFP_KERNEL); if (setChannelPlan_param == NULL) { res = _FAIL; goto exit; @@ -1393,7 +1397,7 @@ u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan, u8 enqueue) if (enqueue) { /* need enqueue, prepare cmd_obj and enqueue */ - pcmdobj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + pcmdobj = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); if (pcmdobj == NULL) { kfree(setChannelPlan_param); res = _FAIL; @@ -1429,13 +1433,13 @@ u8 rtw_led_blink_cmd(struct adapter *padapter, struct LED_871x *pLed) RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_led_blink_cmd\n")); - pcmdobj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + pcmdobj = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (pcmdobj == NULL) { res = _FAIL; goto exit; } - ledBlink_param = (struct LedBlink_param *)rtw_zmalloc(sizeof(struct LedBlink_param)); + ledBlink_param = kzalloc(sizeof(struct LedBlink_param), GFP_ATOMIC); if (ledBlink_param == NULL) { kfree(pcmdobj); res = _FAIL; @@ -1462,13 +1466,14 @@ u8 rtw_set_csa_cmd(struct adapter *padapter, u8 new_ch_no) RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_set_csa_cmd\n")); - pcmdobj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + pcmdobj = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (pcmdobj == NULL) { res = _FAIL; goto exit; } - setChannelSwitch_param = (struct SetChannelSwitch_param *)rtw_zmalloc(sizeof(struct SetChannelSwitch_param)); + setChannelSwitch_param = kzalloc(sizeof(struct SetChannelSwitch_param), + GFP_ATOMIC); if (setChannelSwitch_param == NULL) { kfree(pcmdobj); res = _FAIL; @@ -1626,13 +1631,14 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue) /* return res; */ if (enqueue) { - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (ph2c == NULL) { res = _FAIL; goto exit; } - pdrvextra_cmd_parm = (struct drvextra_cmd_parm *)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); + pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), + GFP_ATOMIC); if (pdrvextra_cmd_parm == NULL) { kfree(ph2c); res = _FAIL; @@ -1668,13 +1674,14 @@ u8 rtw_rpt_timer_cfg_cmd(struct adapter *padapter, u16 min_time) u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (ph2c == NULL) { res = _FAIL; goto exit; } - pdrvextra_cmd_parm = (struct drvextra_cmd_parm *)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); + pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), + GFP_ATOMIC); if (pdrvextra_cmd_parm == NULL) { kfree(ph2c); res = _FAIL; @@ -1709,13 +1716,14 @@ u8 rtw_antenna_select_cmd(struct adapter *padapter, u8 antenna, u8 enqueue) return res; if (enqueue) { - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); if (ph2c == NULL) { res = _FAIL; goto exit; } - pdrvextra_cmd_parm = (struct drvextra_cmd_parm *)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); + pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), + GFP_KERNEL); if (pdrvextra_cmd_parm == NULL) { kfree(ph2c); res = _FAIL; @@ -1753,13 +1761,13 @@ u8 p2p_protocol_wk_cmd(struct adapter *padapter, int intCmdType) if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) return res; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (ph2c == NULL) { res = _FAIL; goto exit; } - pdrvextra_cmd_parm = (struct drvextra_cmd_parm *)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); + pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); if (pdrvextra_cmd_parm == NULL) { kfree(ph2c); res = _FAIL; @@ -1788,13 +1796,13 @@ u8 rtw_ps_cmd(struct adapter *padapter) u8 res = _SUCCESS; - ppscmd = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ppscmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (ppscmd == NULL) { res = _FAIL; goto exit; } - pdrvextra_cmd_parm = (struct drvextra_cmd_parm *)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); + pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); if (pdrvextra_cmd_parm == NULL) { kfree(ppscmd); res = _FAIL; @@ -1861,13 +1869,13 @@ u8 rtw_chk_hi_queue_cmd(struct adapter *padapter) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); if (ph2c == NULL) { res = _FAIL; goto exit; } - pdrvextra_cmd_parm = (struct drvextra_cmd_parm *)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); + pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_KERNEL); if (pdrvextra_cmd_parm == NULL) { kfree(ph2c); res = _FAIL; @@ -1893,13 +1901,13 @@ u8 rtw_c2h_wk_cmd(struct adapter *padapter, u8 *c2h_evt) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); if (ph2c == NULL) { res = _FAIL; goto exit; } - pdrvextra_cmd_parm = (struct drvextra_cmd_parm *)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); + pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); if (pdrvextra_cmd_parm == NULL) { kfree(ph2c); res = _FAIL;