Commit 2ef2b7c2 authored by Joe Perches's avatar Joe Perches Committed by Greg Kroah-Hartman

staging: rtl8723bs: Remove unnecessary rtw_z?malloc casts

These functions now return void * and no longer need casts.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 35628c4a
...@@ -1581,15 +1581,13 @@ u8 rtw_ap_set_pairwise_key(struct adapter *padapter, struct sta_info *psta) ...@@ -1581,15 +1581,13 @@ u8 rtw_ap_set_pairwise_key(struct adapter *padapter, struct sta_info *psta)
struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
u8 res = _SUCCESS; u8 res = _SUCCESS;
ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
if (ph2c == NULL) { if (ph2c == NULL) {
res = _FAIL; res = _FAIL;
goto exit; goto exit;
} }
psetstakey_para = (struct set_stakey_parm *)rtw_zmalloc( psetstakey_para = rtw_zmalloc(sizeof(struct set_stakey_parm));
sizeof(struct set_stakey_parm)
);
if (psetstakey_para == NULL) { if (psetstakey_para == NULL) {
kfree((u8 *) ph2c); kfree((u8 *) ph2c);
res = _FAIL; res = _FAIL;
...@@ -1630,12 +1628,12 @@ static int rtw_ap_set_key( ...@@ -1630,12 +1628,12 @@ static int rtw_ap_set_key(
/* DBG_871X("%s\n", __func__); */ /* DBG_871X("%s\n", __func__); */
pcmd = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); pcmd = rtw_zmalloc(sizeof(struct cmd_obj));
if (pcmd == NULL) { if (pcmd == NULL) {
res = _FAIL; res = _FAIL;
goto exit; goto exit;
} }
psetkeyparm = (struct setkey_parm *)rtw_zmalloc(sizeof(struct setkey_parm)); psetkeyparm = rtw_zmalloc(sizeof(struct setkey_parm));
if (psetkeyparm == NULL) { if (psetkeyparm == NULL) {
kfree((unsigned char *)pcmd); kfree((unsigned char *)pcmd);
res = _FAIL; res = _FAIL;
......
This diff is collapsed.
...@@ -2272,13 +2272,13 @@ sint rtw_set_auth(struct adapter *adapter, struct security_priv *psecuritypriv) ...@@ -2272,13 +2272,13 @@ sint rtw_set_auth(struct adapter *adapter, struct security_priv *psecuritypriv)
struct cmd_priv *pcmdpriv = &(adapter->cmdpriv); struct cmd_priv *pcmdpriv = &(adapter->cmdpriv);
sint res = _SUCCESS; sint res = _SUCCESS;
pcmd = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); pcmd = rtw_zmalloc(sizeof(struct cmd_obj));
if (pcmd == NULL) { if (pcmd == NULL) {
res = _FAIL; /* try again */ res = _FAIL; /* try again */
goto exit; goto exit;
} }
psetauthparm = (struct setauth_parm *)rtw_zmalloc(sizeof(struct setauth_parm)); psetauthparm = rtw_zmalloc(sizeof(struct setauth_parm));
if (psetauthparm == NULL) { if (psetauthparm == NULL) {
kfree((unsigned char *)pcmd); kfree((unsigned char *)pcmd);
res = _FAIL; res = _FAIL;
...@@ -2313,7 +2313,7 @@ sint rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv, s ...@@ -2313,7 +2313,7 @@ sint rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv, s
struct cmd_priv *pcmdpriv = &(adapter->cmdpriv); struct cmd_priv *pcmdpriv = &(adapter->cmdpriv);
sint res = _SUCCESS; sint res = _SUCCESS;
psetkeyparm = (struct setkey_parm *)rtw_zmalloc(sizeof(struct setkey_parm)); psetkeyparm = rtw_zmalloc(sizeof(struct setkey_parm));
if (psetkeyparm == NULL) { if (psetkeyparm == NULL) {
res = _FAIL; res = _FAIL;
goto exit; goto exit;
...@@ -2365,7 +2365,7 @@ sint rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv, s ...@@ -2365,7 +2365,7 @@ sint rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv, s
if (enqueue) { if (enqueue) {
pcmd = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); pcmd = rtw_zmalloc(sizeof(struct cmd_obj));
if (pcmd == NULL) { if (pcmd == NULL) {
kfree((unsigned char *)psetkeyparm); kfree((unsigned char *)psetkeyparm);
res = _FAIL; /* try again */ res = _FAIL; /* try again */
......
...@@ -818,7 +818,7 @@ unsigned int OnBeacon(struct adapter *padapter, union recv_frame *precv_frame) ...@@ -818,7 +818,7 @@ unsigned int OnBeacon(struct adapter *padapter, union recv_frame *precv_frame)
if (!memcmp(GetAddr3Ptr(pframe), get_my_bssid(&pmlmeinfo->network), ETH_ALEN)) { if (!memcmp(GetAddr3Ptr(pframe), get_my_bssid(&pmlmeinfo->network), ETH_ALEN)) {
if (pmlmeinfo->state & WIFI_FW_AUTH_NULL) { if (pmlmeinfo->state & WIFI_FW_AUTH_NULL) {
/* we should update current network before auth, or some IE is wrong */ /* we should update current network before auth, or some IE is wrong */
pbss = (struct wlan_bssid_ex *)rtw_malloc(sizeof(struct wlan_bssid_ex)); pbss = rtw_malloc(sizeof(struct wlan_bssid_ex));
if (pbss) { if (pbss) {
if (collect_bss_info(padapter, precv_frame, pbss) == _SUCCESS) { if (collect_bss_info(padapter, precv_frame, pbss) == _SUCCESS) {
update_network(&(pmlmepriv->cur_network.network), pbss, padapter, true); update_network(&(pmlmepriv->cur_network.network), pbss, padapter, true);
...@@ -5049,12 +5049,12 @@ void report_survey_event(struct adapter *padapter, union recv_frame *precv_frame ...@@ -5049,12 +5049,12 @@ void report_survey_event(struct adapter *padapter, union recv_frame *precv_frame
pmlmeext = &padapter->mlmeextpriv; pmlmeext = &padapter->mlmeextpriv;
pcmdpriv = &padapter->cmdpriv; pcmdpriv = &padapter->cmdpriv;
pcmd_obj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); pcmd_obj = rtw_zmalloc(sizeof(struct cmd_obj));
if (pcmd_obj == NULL) if (pcmd_obj == NULL)
return; return;
cmdsz = (sizeof(struct survey_event) + sizeof(struct C2HEvent_Header)); cmdsz = (sizeof(struct survey_event) + sizeof(struct C2HEvent_Header));
pevtcmd = (u8 *)rtw_zmalloc(cmdsz); pevtcmd = rtw_zmalloc(cmdsz);
if (pevtcmd == NULL) { if (pevtcmd == NULL) {
kfree((u8 *)pcmd_obj); kfree((u8 *)pcmd_obj);
return; return;
...@@ -5102,12 +5102,12 @@ void report_surveydone_event(struct adapter *padapter) ...@@ -5102,12 +5102,12 @@ void report_surveydone_event(struct adapter *padapter)
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
pcmd_obj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); pcmd_obj = rtw_zmalloc(sizeof(struct cmd_obj));
if (pcmd_obj == NULL) if (pcmd_obj == NULL)
return; return;
cmdsz = (sizeof(struct surveydone_event) + sizeof(struct C2HEvent_Header)); cmdsz = (sizeof(struct surveydone_event) + sizeof(struct C2HEvent_Header));
pevtcmd = (u8 *)rtw_zmalloc(cmdsz); pevtcmd = rtw_zmalloc(cmdsz);
if (pevtcmd == NULL) { if (pevtcmd == NULL) {
kfree((u8 *)pcmd_obj); kfree((u8 *)pcmd_obj);
return; return;
...@@ -5149,12 +5149,12 @@ void report_join_res(struct adapter *padapter, int res) ...@@ -5149,12 +5149,12 @@ void report_join_res(struct adapter *padapter, int res)
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
pcmd_obj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); pcmd_obj = rtw_zmalloc(sizeof(struct cmd_obj));
if (pcmd_obj == NULL) if (pcmd_obj == NULL)
return; return;
cmdsz = (sizeof(struct joinbss_event) + sizeof(struct C2HEvent_Header)); cmdsz = (sizeof(struct joinbss_event) + sizeof(struct C2HEvent_Header));
pevtcmd = (u8 *)rtw_zmalloc(cmdsz); pevtcmd = rtw_zmalloc(cmdsz);
if (pevtcmd == NULL) { if (pevtcmd == NULL) {
kfree((u8 *)pcmd_obj); kfree((u8 *)pcmd_obj);
return; return;
...@@ -5200,12 +5200,12 @@ void report_wmm_edca_update(struct adapter *padapter) ...@@ -5200,12 +5200,12 @@ void report_wmm_edca_update(struct adapter *padapter)
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
pcmd_obj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); pcmd_obj = rtw_zmalloc(sizeof(struct cmd_obj));
if (pcmd_obj == NULL) if (pcmd_obj == NULL)
return; return;
cmdsz = (sizeof(struct wmm_event) + sizeof(struct C2HEvent_Header)); cmdsz = (sizeof(struct wmm_event) + sizeof(struct C2HEvent_Header));
pevtcmd = (u8 *)rtw_zmalloc(cmdsz); pevtcmd = rtw_zmalloc(cmdsz);
if (pevtcmd == NULL) { if (pevtcmd == NULL) {
kfree((u8 *)pcmd_obj); kfree((u8 *)pcmd_obj);
return; return;
...@@ -5246,13 +5246,13 @@ void report_del_sta_event(struct adapter *padapter, unsigned char *MacAddr, unsi ...@@ -5246,13 +5246,13 @@ void report_del_sta_event(struct adapter *padapter, unsigned char *MacAddr, unsi
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
pcmd_obj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); pcmd_obj = rtw_zmalloc(sizeof(struct cmd_obj));
if (pcmd_obj == NULL) { if (pcmd_obj == NULL) {
return; return;
} }
cmdsz = (sizeof(struct stadel_event) + sizeof(struct C2HEvent_Header)); cmdsz = (sizeof(struct stadel_event) + sizeof(struct C2HEvent_Header));
pevtcmd = (u8 *)rtw_zmalloc(cmdsz); pevtcmd = rtw_zmalloc(cmdsz);
if (pevtcmd == NULL) { if (pevtcmd == NULL) {
kfree((u8 *)pcmd_obj); kfree((u8 *)pcmd_obj);
return; return;
...@@ -5302,12 +5302,12 @@ void report_add_sta_event(struct adapter *padapter, unsigned char *MacAddr, int ...@@ -5302,12 +5302,12 @@ void report_add_sta_event(struct adapter *padapter, unsigned char *MacAddr, int
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
pcmd_obj = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); pcmd_obj = rtw_zmalloc(sizeof(struct cmd_obj));
if (pcmd_obj == NULL) if (pcmd_obj == NULL)
return; return;
cmdsz = (sizeof(struct stassoc_event) + sizeof(struct C2HEvent_Header)); cmdsz = (sizeof(struct stassoc_event) + sizeof(struct C2HEvent_Header));
pevtcmd = (u8 *)rtw_zmalloc(cmdsz); pevtcmd = rtw_zmalloc(cmdsz);
if (pevtcmd == NULL) { if (pevtcmd == NULL) {
kfree((u8 *)pcmd_obj); kfree((u8 *)pcmd_obj);
return; return;
...@@ -5853,12 +5853,12 @@ void survey_timer_hdl(struct adapter *padapter) ...@@ -5853,12 +5853,12 @@ void survey_timer_hdl(struct adapter *padapter)
pmlmeext->scan_abort = false;/* reset */ pmlmeext->scan_abort = false;/* reset */
} }
ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
if (ph2c == NULL) { if (ph2c == NULL) {
goto exit_survey_timer_hdl; goto exit_survey_timer_hdl;
} }
psurveyPara = (struct sitesurvey_parm *)rtw_zmalloc(sizeof(struct sitesurvey_parm)); psurveyPara = rtw_zmalloc(sizeof(struct sitesurvey_parm));
if (psurveyPara == NULL) { if (psurveyPara == NULL) {
kfree((unsigned char *)ph2c); kfree((unsigned char *)ph2c);
goto exit_survey_timer_hdl; goto exit_survey_timer_hdl;
...@@ -6602,7 +6602,7 @@ u8 chk_bmc_sleepq_cmd(struct adapter *padapter) ...@@ -6602,7 +6602,7 @@ u8 chk_bmc_sleepq_cmd(struct adapter *padapter)
struct cmd_priv *pcmdpriv = &(padapter->cmdpriv); struct cmd_priv *pcmdpriv = &(padapter->cmdpriv);
u8 res = _SUCCESS; u8 res = _SUCCESS;
ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
if (ph2c == NULL) { if (ph2c == NULL) {
res = _FAIL; res = _FAIL;
goto exit; goto exit;
...@@ -6626,13 +6626,13 @@ u8 set_tx_beacon_cmd(struct adapter *padapter) ...@@ -6626,13 +6626,13 @@ u8 set_tx_beacon_cmd(struct adapter *padapter)
u8 res = _SUCCESS; u8 res = _SUCCESS;
int len_diff = 0; int len_diff = 0;
ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj)); ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
if (ph2c == NULL) { if (ph2c == NULL) {
res = _FAIL; res = _FAIL;
goto exit; goto exit;
} }
ptxBeacon_parm = (struct Tx_Beacon_param *)rtw_zmalloc(sizeof(struct Tx_Beacon_param)); ptxBeacon_parm = rtw_zmalloc(sizeof(struct Tx_Beacon_param));
if (ptxBeacon_parm == NULL) { if (ptxBeacon_parm == NULL) {
kfree((unsigned char *)ph2c); kfree((unsigned char *)ph2c);
res = _FAIL; res = _FAIL;
......
...@@ -2272,7 +2272,7 @@ static void *aes_encrypt_init(u8 *key, size_t len) ...@@ -2272,7 +2272,7 @@ static void *aes_encrypt_init(u8 *key, size_t len)
u32 *rk; u32 *rk;
if (len != 16) if (len != 16)
return NULL; return NULL;
rk = (u32 *)rtw_malloc(AES_PRIV_SIZE); rk = rtw_malloc(AES_PRIV_SIZE);
if (rk == NULL) if (rk == NULL)
return NULL; return NULL;
rijndaelKeySetupEnc(rk, key); rijndaelKeySetupEnc(rk, key);
......
...@@ -1359,7 +1359,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) ...@@ -1359,7 +1359,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len)
return true; return true;
} }
bssid = (struct wlan_bssid_ex *)rtw_zmalloc(sizeof(struct wlan_bssid_ex)); bssid = rtw_zmalloc(sizeof(struct wlan_bssid_ex));
if (bssid == NULL) { if (bssid == NULL) {
DBG_871X("%s rtw_zmalloc fail !!!\n", __func__); DBG_871X("%s rtw_zmalloc fail !!!\n", __func__);
return true; return true;
......
...@@ -2166,7 +2166,7 @@ void rtw_alloc_hwxmits(struct adapter *padapter) ...@@ -2166,7 +2166,7 @@ void rtw_alloc_hwxmits(struct adapter *padapter)
pxmitpriv->hwxmits = NULL; pxmitpriv->hwxmits = NULL;
pxmitpriv->hwxmits = (struct hw_xmit *)rtw_zmalloc(sizeof(struct hw_xmit) * pxmitpriv->hwxmit_entry); pxmitpriv->hwxmits = rtw_zmalloc(sizeof(struct hw_xmit) * pxmitpriv->hwxmit_entry);
if (pxmitpriv->hwxmits == NULL) { if (pxmitpriv->hwxmits == NULL) {
DBG_871X("alloc hwxmits fail!...\n"); DBG_871X("alloc hwxmits fail!...\n");
......
...@@ -891,7 +891,7 @@ static void hal_ReadEFuse_WiFi( ...@@ -891,7 +891,7 @@ static void hal_ReadEFuse_WiFi(
return; return;
} }
efuseTbl = (u8 *)rtw_malloc(EFUSE_MAX_MAP_LEN); efuseTbl = rtw_malloc(EFUSE_MAX_MAP_LEN);
if (efuseTbl == NULL) { if (efuseTbl == NULL) {
DBG_8192C("%s: alloc efuseTbl fail!\n", __func__); DBG_8192C("%s: alloc efuseTbl fail!\n", __func__);
return; return;
......
...@@ -218,7 +218,7 @@ static u32 sdio_read32(struct intf_hdl *pintfhdl, u32 addr) ...@@ -218,7 +218,7 @@ static u32 sdio_read32(struct intf_hdl *pintfhdl, u32 addr)
} else { } else {
u8 *ptmpbuf; u8 *ptmpbuf;
ptmpbuf = (u8 *)rtw_malloc(8); ptmpbuf = rtw_malloc(8);
if (NULL == ptmpbuf) { if (NULL == ptmpbuf) {
DBG_8192C(KERN_ERR "%s: Allocate memory FAIL!(size =8) addr = 0x%x\n", __func__, addr); DBG_8192C(KERN_ERR "%s: Allocate memory FAIL!(size =8) addr = 0x%x\n", __func__, addr);
return SDIO_ERR_VAL32; return SDIO_ERR_VAL32;
...@@ -594,7 +594,7 @@ static s32 _sdio_local_read( ...@@ -594,7 +594,7 @@ static s32 _sdio_local_read(
} }
n = RND4(cnt); n = RND4(cnt);
ptmpbuf = (u8 *)rtw_malloc(n); ptmpbuf = rtw_malloc(n);
if (!ptmpbuf) if (!ptmpbuf)
return (-1); return (-1);
...@@ -637,7 +637,7 @@ s32 sdio_local_read( ...@@ -637,7 +637,7 @@ s32 sdio_local_read(
} }
n = RND4(cnt); n = RND4(cnt);
ptmpbuf = (u8 *)rtw_malloc(n); ptmpbuf = rtw_malloc(n);
if (!ptmpbuf) if (!ptmpbuf)
return (-1); return (-1);
...@@ -684,7 +684,7 @@ s32 sdio_local_write( ...@@ -684,7 +684,7 @@ s32 sdio_local_write(
return err; return err;
} }
ptmpbuf = (u8 *)rtw_malloc(cnt); ptmpbuf = rtw_malloc(cnt);
if (!ptmpbuf) if (!ptmpbuf)
return (-1); return (-1);
...@@ -1108,7 +1108,7 @@ void sd_int_dpc(struct adapter *padapter) ...@@ -1108,7 +1108,7 @@ void sd_int_dpc(struct adapter *padapter)
struct c2h_evt_hdr_88xx *c2h_evt; struct c2h_evt_hdr_88xx *c2h_evt;
DBG_8192C("%s: C2H Command\n", __func__); DBG_8192C("%s: C2H Command\n", __func__);
c2h_evt = (struct c2h_evt_hdr_88xx *)rtw_zmalloc(16); c2h_evt = rtw_zmalloc(16);
if (c2h_evt != NULL) { if (c2h_evt != NULL) {
if (rtw_hal_c2h_evt_read(padapter, (u8 *)c2h_evt) == _SUCCESS) { if (rtw_hal_c2h_evt_read(padapter, (u8 *)c2h_evt) == _SUCCESS) {
if (c2h_id_filter_ccx_8723b((u8 *)c2h_evt)) { if (c2h_id_filter_ccx_8723b((u8 *)c2h_evt)) {
......
...@@ -136,11 +136,9 @@ static struct ieee80211_supported_band *rtw_spt_band_alloc( ...@@ -136,11 +136,9 @@ static struct ieee80211_supported_band *rtw_spt_band_alloc(
goto exit; goto exit;
} }
spt_band = (struct ieee80211_supported_band *)rtw_zmalloc( spt_band = rtw_zmalloc(sizeof(struct ieee80211_supported_band) +
sizeof(struct ieee80211_supported_band) sizeof(struct ieee80211_channel) * n_channels +
+ sizeof(struct ieee80211_channel)*n_channels sizeof(struct ieee80211_rate) * n_bitrates);
+ sizeof(struct ieee80211_rate)*n_bitrates
);
if (!spt_band) if (!spt_band)
goto exit; goto exit;
...@@ -1094,7 +1092,7 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev, ...@@ -1094,7 +1092,7 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev,
DBG_871X("pairwise =%d\n", pairwise); DBG_871X("pairwise =%d\n", pairwise);
param_len = sizeof(struct ieee_param) + params->key_len; param_len = sizeof(struct ieee_param) + params->key_len;
param = (struct ieee_param *)rtw_malloc(param_len); param = rtw_malloc(param_len);
if (param == NULL) if (param == NULL)
return -1; return -1;
...@@ -2183,7 +2181,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, ...@@ -2183,7 +2181,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
{ {
wep_key_len = wep_key_len <= 5 ? 5 : 13; wep_key_len = wep_key_len <= 5 ? 5 : 13;
wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial); wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial);
pwep =(struct ndis_802_11_wep *) rtw_malloc(wep_total_len); pwep = rtw_malloc(wep_total_len);
if (pwep == NULL) { if (pwep == NULL) {
DBG_871X(" wpa_set_encryption: pwep allocate fail !!!\n"); DBG_871X(" wpa_set_encryption: pwep allocate fail !!!\n");
ret = -ENOMEM; ret = -ENOMEM;
...@@ -2677,7 +2675,7 @@ static int rtw_cfg80211_add_monitor_if (struct adapter *padapter, char *name, st ...@@ -2677,7 +2675,7 @@ static int rtw_cfg80211_add_monitor_if (struct adapter *padapter, char *name, st
pnpi->sizeof_priv = sizeof(struct adapter); pnpi->sizeof_priv = sizeof(struct adapter);
/* wdev */ /* wdev */
mon_wdev = (struct wireless_dev *)rtw_zmalloc(sizeof(struct wireless_dev)); mon_wdev = rtw_zmalloc(sizeof(struct wireless_dev));
if (!mon_wdev) { if (!mon_wdev) {
DBG_871X(FUNC_ADPT_FMT" allocate mon_wdev fail\n", FUNC_ADPT_ARG(padapter)); DBG_871X(FUNC_ADPT_FMT" allocate mon_wdev fail\n", FUNC_ADPT_ARG(padapter));
ret = -ENOMEM; ret = -ENOMEM;
...@@ -3497,7 +3495,7 @@ int rtw_wdev_alloc(struct adapter *padapter, struct device *dev) ...@@ -3497,7 +3495,7 @@ int rtw_wdev_alloc(struct adapter *padapter, struct device *dev)
} }
/* wdev */ /* wdev */
wdev = (struct wireless_dev *)rtw_zmalloc(sizeof(struct wireless_dev)); wdev = rtw_zmalloc(sizeof(struct wireless_dev));
if (!wdev) { if (!wdev) {
DBG_8192C("Couldn't allocate wireless device\n"); DBG_8192C("Couldn't allocate wireless device\n");
ret = -ENOMEM; ret = -ENOMEM;
......
...@@ -557,7 +557,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, ...@@ -557,7 +557,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
if (wep_key_len > 0) { if (wep_key_len > 0) {
wep_key_len = wep_key_len <= 5 ? 5 : 13; wep_key_len = wep_key_len <= 5 ? 5 : 13;
wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial); wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial);
pwep =(struct ndis_802_11_wep *) rtw_malloc(wep_total_len); pwep = rtw_malloc(wep_total_len);
if (pwep == NULL) { if (pwep == NULL) {
RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_err_, (" wpa_set_encryption: pwep allocate fail !!!\n")); RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_err_, (" wpa_set_encryption: pwep allocate fail !!!\n"));
goto exit; goto exit;
...@@ -2238,7 +2238,7 @@ static int rtw_wx_set_enc_ext(struct net_device *dev, ...@@ -2238,7 +2238,7 @@ static int rtw_wx_set_enc_ext(struct net_device *dev,
int ret = 0; int ret = 0;
param_len = sizeof(struct ieee_param) + pext->key_len; param_len = sizeof(struct ieee_param) + pext->key_len;
param = (struct ieee_param *)rtw_malloc(param_len); param = rtw_malloc(param_len);
if (param == NULL) if (param == NULL)
return -1; return -1;
...@@ -2347,7 +2347,7 @@ static int rtw_wx_read32(struct net_device *dev, ...@@ -2347,7 +2347,7 @@ static int rtw_wx_read32(struct net_device *dev,
if (0 == len) if (0 == len)
return -EINVAL; return -EINVAL;
ptmp = (u8 *)rtw_malloc(len); ptmp = rtw_malloc(len);
if (NULL == ptmp) if (NULL == ptmp)
return -ENOMEM; return -ENOMEM;
...@@ -3500,7 +3500,7 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p) ...@@ -3500,7 +3500,7 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p)
goto out; goto out;
} }
param = (struct ieee_param *)rtw_malloc(p->length); param = rtw_malloc(p->length);
if (param == NULL) { if (param == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
...@@ -3621,7 +3621,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, ...@@ -3621,7 +3621,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
if (wep_key_len > 0) { if (wep_key_len > 0) {
wep_key_len = wep_key_len <= 5 ? 5 : 13; wep_key_len = wep_key_len <= 5 ? 5 : 13;
wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial); wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial);
pwep =(struct ndis_802_11_wep *)rtw_malloc(wep_total_len); pwep = rtw_malloc(wep_total_len);
if (pwep == NULL) { if (pwep == NULL) {
DBG_871X(" r871x_set_encryption: pwep allocate fail !!!\n"); DBG_871X(" r871x_set_encryption: pwep allocate fail !!!\n");
goto exit; goto exit;
...@@ -4345,7 +4345,7 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p) ...@@ -4345,7 +4345,7 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p)
goto out; goto out;
} }
param = (struct ieee_param *)rtw_malloc(p->length); param = rtw_malloc(p->length);
if (param == NULL) { if (param == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
...@@ -4673,7 +4673,7 @@ static int rtw_test( ...@@ -4673,7 +4673,7 @@ static int rtw_test(
DBG_871X("+%s\n", __func__); DBG_871X("+%s\n", __func__);
len = wrqu->data.length; len = wrqu->data.length;
pbuf = (u8 *)rtw_zmalloc(len); pbuf = rtw_zmalloc(len);
if (pbuf == NULL) { if (pbuf == NULL) {
DBG_871X("%s: no memory!\n", __func__); DBG_871X("%s: no memory!\n", __func__);
return -ENOMEM; return -ENOMEM;
......
...@@ -691,7 +691,8 @@ struct dvobj_priv *devobj_init(void) ...@@ -691,7 +691,8 @@ struct dvobj_priv *devobj_init(void)
{ {
struct dvobj_priv *pdvobj = NULL; struct dvobj_priv *pdvobj = NULL;
if ((pdvobj = (struct dvobj_priv*)rtw_zmalloc(sizeof(*pdvobj))) == NULL) pdvobj = rtw_zmalloc(sizeof(*pdvobj));
if (pdvobj == NULL)
return NULL; return NULL;
mutex_init(&pdvobj->hw_init_mutex); mutex_init(&pdvobj->hw_init_mutex);
......
...@@ -465,7 +465,7 @@ struct rtw_cbuf *rtw_cbuf_alloc(u32 size) ...@@ -465,7 +465,7 @@ struct rtw_cbuf *rtw_cbuf_alloc(u32 size)
{ {
struct rtw_cbuf *cbuf; struct rtw_cbuf *cbuf;
cbuf = (struct rtw_cbuf *)rtw_malloc(sizeof(*cbuf) + sizeof(void*)*size); cbuf = rtw_malloc(sizeof(*cbuf) + sizeof(void *) * size);
if (cbuf) { if (cbuf) {
cbuf->write = cbuf->read = 0; cbuf->write = cbuf->read = 0;
......
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