Commit fadbe0cd authored by navin patidar's avatar navin patidar Committed by Greg Kroah-Hartman

staging: rtl8188eu:Remove rtw_zmalloc(), wrapper for kzalloc()

Signed-off-by: default avatarnavin patidar <navin.patidar@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a733e467
This diff is collapsed.
......@@ -103,7 +103,7 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8 *pbuf)
u16 efuse_utilized = 0;
u8 u1temp = 0;
efuseTbl = (u8 *)rtw_zmalloc(EFUSE_MAP_LEN_88E);
efuseTbl = kzalloc(EFUSE_MAP_LEN_88E, GFP_KERNEL);
if (efuseTbl == NULL) {
DBG_88E("%s: alloc efuseTbl fail!\n", __func__);
goto exit;
......@@ -1083,7 +1083,7 @@ u8 rtw_efuse_map_write(struct adapter *padapter, u16 addr, u16 cnts, u8 *data)
if ((addr + cnts) > mapLen)
return _FAIL;
map = rtw_zmalloc(mapLen);
map = kzalloc(mapLen, GFP_KERNEL);
if (map == NULL)
return _FAIL;
......
......@@ -1666,13 +1666,13 @@ int rtw_set_auth(struct adapter *adapter, struct security_priv *psecuritypriv)
struct cmd_priv *pcmdpriv = &(adapter->cmdpriv);
int res = _SUCCESS;
pcmd = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj));
pcmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
if (pcmd == NULL) {
res = _FAIL; /* try again */
goto exit;
}
psetauthparm = (struct setauth_parm *)rtw_zmalloc(sizeof(struct setauth_parm));
psetauthparm = kzalloc(sizeof(struct setauth_parm), GFP_KERNEL);
if (psetauthparm == NULL) {
kfree(pcmd);
res = _FAIL;
......@@ -1703,11 +1703,11 @@ int rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv, in
struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
int res = _SUCCESS;
pcmd = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj));
pcmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
if (pcmd == NULL)
return _FAIL; /* try again */
psetkeyparm = (struct setkey_parm *)rtw_zmalloc(sizeof(struct setkey_parm));
psetkeyparm = kzalloc(sizeof(struct setkey_parm), GFP_KERNEL);
if (psetkeyparm == NULL) {
res = _FAIL;
goto err_free_cmd;
......
......@@ -7055,12 +7055,12 @@ void report_survey_event(struct adapter *padapter,
pcmdpriv = &padapter->cmdpriv;
pcmd_obj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj));
pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
if (pcmd_obj == NULL)
return;
cmdsz = (sizeof(struct survey_event) + sizeof(struct C2HEvent_Header));
pevtcmd = (u8 *)rtw_zmalloc(cmdsz);
pevtcmd = kzalloc(cmdsz, GFP_KERNEL);
if (pevtcmd == NULL) {
kfree(pcmd_obj);
return;
......@@ -7107,12 +7107,12 @@ void report_surveydone_event(struct adapter *padapter)
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
pcmd_obj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj));
pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
if (pcmd_obj == NULL)
return;
cmdsz = (sizeof(struct surveydone_event) + sizeof(struct C2HEvent_Header));
pevtcmd = (u8 *)rtw_zmalloc(cmdsz);
pevtcmd = kzalloc(cmdsz, GFP_KERNEL);
if (pevtcmd == NULL) {
kfree(pcmd_obj);
return;
......@@ -7153,12 +7153,12 @@ void report_join_res(struct adapter *padapter, int res)
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
pcmd_obj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj));
pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
if (pcmd_obj == NULL)
return;
cmdsz = (sizeof(struct joinbss_event) + sizeof(struct C2HEvent_Header));
pevtcmd = (u8 *)rtw_zmalloc(cmdsz);
pevtcmd = kzalloc(cmdsz, GFP_KERNEL);
if (pevtcmd == NULL) {
kfree(pcmd_obj);
return;
......@@ -7206,12 +7206,12 @@ void report_del_sta_event(struct adapter *padapter, unsigned char *MacAddr, unsi
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
pcmd_obj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj));
pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
if (pcmd_obj == NULL)
return;
cmdsz = (sizeof(struct stadel_event) + sizeof(struct C2HEvent_Header));
pevtcmd = (u8 *)rtw_zmalloc(cmdsz);
pevtcmd = kzalloc(cmdsz, GFP_KERNEL);
if (pevtcmd == NULL) {
kfree(pcmd_obj);
return;
......@@ -7261,12 +7261,12 @@ void report_add_sta_event(struct adapter *padapter, unsigned char *MacAddr, int
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
pcmd_obj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj));
pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
if (pcmd_obj == NULL)
return;
cmdsz = (sizeof(struct stassoc_event) + sizeof(struct C2HEvent_Header));
pevtcmd = (u8 *)rtw_zmalloc(cmdsz);
pevtcmd = kzalloc(cmdsz, GFP_KERNEL);
if (pevtcmd == NULL) {
kfree(pcmd_obj);
return;
......@@ -7686,11 +7686,11 @@ void survey_timer_hdl(struct adapter *padapter)
pmlmeext->scan_abort = false;/* reset */
}
ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj));
ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
if (ph2c == NULL)
goto exit_survey_timer_hdl;
psurveyPara = (struct sitesurvey_parm *)rtw_zmalloc(sizeof(struct sitesurvey_parm));
psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_KERNEL);
if (psurveyPara == NULL) {
kfree(ph2c);
goto exit_survey_timer_hdl;
......@@ -8268,13 +8268,13 @@ u8 set_tx_beacon_cmd(struct adapter *padapter)
int len_diff = 0;
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;
}
ptxBeacon_parm = (struct Tx_Beacon_param *)rtw_zmalloc(sizeof(struct Tx_Beacon_param));
ptxBeacon_parm = kzalloc(sizeof(struct Tx_Beacon_param), GFP_KERNEL);
if (ptxBeacon_parm == NULL) {
kfree(ph2c);
res = _FAIL;
......
......@@ -687,7 +687,7 @@ void SetPacketTx(struct adapter *padapter)
kfree(pmp_priv->tx.pallocated_buf);
pmp_priv->tx.write_size = pkt_size;
pmp_priv->tx.buf_size = pkt_size + XMITBUF_ALIGN_SZ;
pmp_priv->tx.pallocated_buf = rtw_zmalloc(pmp_priv->tx.buf_size);
pmp_priv->tx.pallocated_buf = kzalloc(pmp_priv->tx.buf_size, GFP_KERNEL);
if (pmp_priv->tx.pallocated_buf == NULL) {
DBG_88E("%s: malloc(%d) fail!!\n", __func__, pmp_priv->tx.buf_size);
return;
......
......@@ -50,7 +50,7 @@ static u32 go_add_group_info_attr(struct wifidirect_info *pwdinfo, u8 *pbuf)
DBG_88E("%s\n", __func__);
pdata_attr = rtw_zmalloc(MAX_P2P_IE_LEN);
pdata_attr = kzalloc(MAX_P2P_IE_LEN, GFP_KERNEL);
pstart = pdata_attr;
pcur = pdata_attr;
......@@ -891,7 +891,7 @@ u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l
/* Check P2P Device Info ATTR */
if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_DEVICE_INFO, NULL, (uint *)&attr_contentlen)) {
DBG_88E("[%s] Got P2P DEVICE INFO Attr!!\n", __func__);
pattr_content = rtw_zmalloc(attr_contentlen);
pattr_content = kzalloc(attr_contentlen, GFP_KERNEL);
pbuf = pattr_content;
if (pattr_content) {
u8 num_of_secdev_type;
......@@ -1738,13 +1738,13 @@ u8 p2p_ps_wk_cmd(struct adapter *padapter, u8 p2p_ps_state, 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;
......
......@@ -935,7 +935,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len)
return true;
}
bssid = (struct wlan_bssid_ex *)rtw_zmalloc(sizeof(struct wlan_bssid_ex));
bssid = kzalloc(sizeof(struct wlan_bssid_ex), GFP_KERNEL);
subtype = GetFrameSubType(pframe) >> 4;
......
......@@ -1637,7 +1637,7 @@ void rtw_alloc_hwxmits(struct adapter *padapter)
pxmitpriv->hwxmit_entry = HWXMIT_ENTRY;
pxmitpriv->hwxmits = (struct hw_xmit *)rtw_zmalloc(sizeof(struct hw_xmit) * pxmitpriv->hwxmit_entry);
pxmitpriv->hwxmits = kzalloc(sizeof(struct hw_xmit) * pxmitpriv->hwxmit_entry, GFP_KERNEL);
hwxmits = pxmitpriv->hwxmits;
......
......@@ -503,7 +503,7 @@ static void SetFwRsvdPagePkt(struct adapter *adapt, bool bDLFinished)
struct rsvdpage_loc RsvdPageLoc;
DBG_88E("%s\n", __func__);
ReservedPagePacket = (u8 *)rtw_zmalloc(1000);
ReservedPagePacket = kzalloc(1000, GFP_KERNEL);
if (ReservedPagePacket == NULL) {
DBG_88E("%s: alloc ReservedPagePacket fail!\n", __func__);
return;
......
......@@ -41,7 +41,7 @@ int rtl8188eu_init_recv_priv(struct adapter *padapter)
/* init recv_buf */
_rtw_init_queue(&precvpriv->free_recv_buf_queue);
precvpriv->pallocated_recv_buf = rtw_zmalloc(NR_RECVBUFF * sizeof(struct recv_buf) + 4);
precvpriv->pallocated_recv_buf = kzalloc(NR_RECVBUFF * sizeof(struct recv_buf) + 4, GFP_KERNEL);
if (precvpriv->pallocated_recv_buf == NULL) {
res = _FAIL;
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("alloc recv_buf fail!\n"));
......
......@@ -2211,7 +2211,7 @@ void rtl8188eu_set_hal_ops(struct adapter *adapt)
struct hal_ops *halfunc = &adapt->HalFunc;
adapt->HalData = rtw_zmalloc(sizeof(struct hal_data_8188e));
adapt->HalData = kzalloc(sizeof(struct hal_data_8188e), GFP_KERNEL);
if (adapt->HalData == NULL)
DBG_88E("cant not alloc memory for HAL DATA\n");
......
......@@ -188,11 +188,9 @@ extern unsigned char WPA_TKIP_CIPHER[4];
extern unsigned char RSN_TKIP_CIPHER[4];
#define rtw_update_mem_stat(flag, sz) do {} while (0)
u8 *_rtw_zmalloc(u32 sz);
u8 *_rtw_malloc(u32 sz);
void _rtw_mfree(u8 *pbuf, u32 sz);
#define rtw_malloc(sz) _rtw_malloc((sz))
#define rtw_zmalloc(sz) _rtw_zmalloc((sz))
#define rtw_mfree(pbuf, sz) _rtw_mfree((pbuf), (sz))
void *rtw_malloc2d(int h, int w, int size);
......
......@@ -632,7 +632,7 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie
}
if (ielen) {
buf = rtw_zmalloc(ielen);
buf = kzalloc(ielen, GFP_KERNEL);
if (buf == NULL) {
ret = -ENOMEM;
goto exit;
......@@ -4721,13 +4721,13 @@ static u8 set_pairwise_key(struct adapter *padapter, struct sta_info *psta)
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;
}
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;
......@@ -4759,12 +4759,12 @@ static int set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid)
DBG_88E("%s\n", __func__);
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;
}
psetkeyparm = (struct setkey_parm *)rtw_zmalloc(sizeof(struct setkey_parm));
psetkeyparm = kzalloc(sizeof(struct setkey_parm), GFP_KERNEL);
if (psetkeyparm == NULL) {
kfree(pcmd);
res = _FAIL;
......@@ -5672,12 +5672,12 @@ static int rtw_mp_efuse_get(struct net_device *dev,
pEfuseHal = &haldata->EfuseHal;
err = 0;
data = _rtw_zmalloc(EFUSE_BT_MAX_MAP_LEN);
data = kzalloc(EFUSE_BT_MAX_MAP_LEN, GFP_KERNEL);
if (data == NULL) {
err = -ENOMEM;
goto exit;
}
rawdata = _rtw_zmalloc(EFUSE_BT_MAX_MAP_LEN);
rawdata = kzalloc(EFUSE_BT_MAX_MAP_LEN, GFP_KERNEL);
if (rawdata == NULL) {
err = -ENOMEM;
goto exit;
......@@ -5916,7 +5916,7 @@ static int rtw_mp_efuse_set(struct net_device *dev,
haldata = GET_HAL_DATA(padapter);
pEfuseHal = &haldata->EfuseHal;
err = 0;
setdata = _rtw_zmalloc(1024);
setdata = kzalloc(1024, GFP_KERNEL);
if (setdata == NULL) {
err = -ENOMEM;
goto exit;
......@@ -7438,7 +7438,7 @@ static int rtw_test(
DBG_88E("+%s\n", __func__);
len = wrqu->data.length;
pbuf = (u8 *)rtw_zmalloc(len);
pbuf = kzalloc(len, GFP_KERNEL);
if (pbuf == NULL) {
DBG_88E("%s: no memory!\n", __func__);
return -ENOMEM;
......@@ -7783,7 +7783,7 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_
memcpy(&wdata, wrq_data, sizeof(wdata));
input_len = wdata.data.length;
input = rtw_zmalloc(input_len);
input = kzalloc(input_len, GFP_KERNEL);
if (NULL == input)
return -ENOMEM;
if (copy_from_user(input, wdata.data.pointer, input_len)) {
......@@ -7850,7 +7850,7 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_
k = j;
}
buffer = rtw_zmalloc(4096);
buffer = kzalloc(4096, GFP_KERNEL);
if (NULL == buffer) {
err = -ENOMEM;
goto exit;
......@@ -7999,7 +7999,7 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_
else
n = wdata.data.length;
output = rtw_zmalloc(4096);
output = kzalloc(4096, GFP_KERNEL);
if (NULL == output) {
err = -ENOMEM;
goto exit;
......
......@@ -47,20 +47,11 @@ u8 *_rtw_malloc(u32 sz)
return pbuf;
}
u8 *_rtw_zmalloc(u32 sz)
{
u8 *pbuf = _rtw_malloc(sz);
if (pbuf != NULL)
memset(pbuf, 0, sz);
return pbuf;
}
void *rtw_malloc2d(int h, int w, int size)
{
int j;
void **a = (void **)rtw_zmalloc(h*sizeof(void *) + h*w*size);
void **a = (void **)kzalloc(h*sizeof(void *) + h*w*size, GFP_KERNEL);
if (a == NULL) {
pr_info("%s: alloc memory fail!\n", __func__);
return NULL;
......
......@@ -66,7 +66,7 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf)
struct usb_device *pusbd;
pdvobjpriv = (struct dvobj_priv *)rtw_zmalloc(sizeof(*pdvobjpriv));
pdvobjpriv = kzalloc(sizeof(*pdvobjpriv), GFP_KERNEL);
if (pdvobjpriv == NULL)
goto exit;
......@@ -116,7 +116,7 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf)
pdvobjpriv->ishighspeed = false;
mutex_init(&pdvobjpriv->usb_vendor_req_mutex);
pdvobjpriv->usb_vendor_req_buf = rtw_zmalloc(MAX_USB_IO_CTL_SIZE);
pdvobjpriv->usb_vendor_req_buf = kzalloc(MAX_USB_IO_CTL_SIZE, GFP_KERNEL);
if (!pdvobjpriv->usb_vendor_req_buf)
goto free_dvobj;
......
......@@ -80,7 +80,7 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitb
{
int i;
pxmitbuf->pallocated_buf = rtw_zmalloc(alloc_sz);
pxmitbuf->pallocated_buf = kzalloc(alloc_sz, GFP_KERNEL);
if (pxmitbuf->pallocated_buf == NULL)
return _FAIL;
......
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