mirror of
https://github.com/Mange/rtl8192eu-linux-driver
synced 2024-12-23 12:37:42 +00:00
Remove wrapper around vfree
This call is so simple that there is no need, or use, for a wrapper. Link: https://lore.kernel.org/r/20210805183717.23007-3-Larry.Finger@lwfinger.net
This commit is contained in:
parent
4d3d23dd24
commit
34ec238387
@ -3213,9 +3213,9 @@ u32 rtw_read_efuse_from_file(const char *path, u8 *buf, int map_size)
|
||||
|
||||
exit:
|
||||
if (file_data)
|
||||
rtw_vmfree(file_data, file_size);
|
||||
vfree(file_data);
|
||||
if (map)
|
||||
rtw_vmfree(map, map_size);
|
||||
vfree(map);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -307,8 +307,7 @@ void _rtw_free_mlme_priv(struct mlme_priv *pmlmepriv)
|
||||
if (pmlmepriv) {
|
||||
rtw_mfree_mlme_priv_lock(pmlmepriv);
|
||||
|
||||
if (pmlmepriv->free_bss_buf)
|
||||
rtw_vmfree(pmlmepriv->free_bss_buf, pmlmepriv->max_bss_cnt * sizeof(struct wlan_network));
|
||||
vfree(pmlmepriv->free_bss_buf);
|
||||
}
|
||||
exit:
|
||||
return;
|
||||
|
@ -2492,8 +2492,7 @@ void _rtw_mp_xmit_priv(struct xmit_priv *pxmitpriv)
|
||||
pxmitbuf++;
|
||||
}
|
||||
|
||||
if (pxmitpriv->pallocated_xmit_extbuf)
|
||||
rtw_vmfree(pxmitpriv->pallocated_xmit_extbuf, num_xmit_extbuf * sizeof(struct xmit_buf) + 4);
|
||||
vfree(pxmitpriv->pallocated_xmit_extbuf);
|
||||
|
||||
if (padapter->registrypriv.mp_mode == 0) {
|
||||
max_xmit_extbuf_size = 6000;
|
||||
|
@ -194,8 +194,7 @@ void _rtw_free_recv_priv(struct recv_priv *precvpriv)
|
||||
|
||||
rtw_os_recv_resource_free(precvpriv);
|
||||
|
||||
if (precvpriv->pallocated_frame_buf)
|
||||
rtw_vmfree(precvpriv->pallocated_frame_buf, NR_RECVFRAME * sizeof(union recv_frame) + RXFRAME_ALIGN_SZ);
|
||||
vfree(precvpriv->pallocated_frame_buf);
|
||||
|
||||
rtw_hal_free_recv_priv(padapter);
|
||||
|
||||
|
@ -1178,7 +1178,7 @@ void rtw_txpwr_lmt_list_free(struct rf_ctl_t *rfctl)
|
||||
if (ent->regd_name == rfctl->regd_name)
|
||||
rfctl->regd_name = regd_str(TXPWR_LMT_NONE);
|
||||
rtw_list_delete(&ent->list);
|
||||
rtw_vmfree((u8 *)ent, sizeof(struct txpwr_lmt_ent) + strlen(ent->regd_name) + 1);
|
||||
vfree(ent);
|
||||
}
|
||||
rfctl->txpwr_regd_num = 0;
|
||||
|
||||
|
@ -320,7 +320,7 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv)
|
||||
exit:
|
||||
if (ret != _SUCCESS) {
|
||||
if (pstapriv->pallocated_stainfo_buf)
|
||||
rtw_vmfree(pstapriv->pallocated_stainfo_buf, sizeof(struct sta_info) * NUM_STA + 4);
|
||||
vfree(pstapriv->pallocated_stainfo_buf);
|
||||
#ifdef CONFIG_AP_MODE
|
||||
if (pstapriv->sta_aid)
|
||||
rtw_mfree(pstapriv->sta_aid, pstapriv->max_aid * sizeof(struct sta_info *));
|
||||
@ -471,7 +471,7 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv)
|
||||
#endif
|
||||
|
||||
if (pstapriv->pallocated_stainfo_buf)
|
||||
rtw_vmfree(pstapriv->pallocated_stainfo_buf, sizeof(struct sta_info) * NUM_STA + 4);
|
||||
vfree(pstapriv->pallocated_stainfo_buf);
|
||||
#ifdef CONFIG_AP_MODE
|
||||
if (pstapriv->sta_aid)
|
||||
rtw_mfree(pstapriv->sta_aid, pstapriv->max_aid * sizeof(struct sta_info *));
|
||||
|
@ -405,12 +405,10 @@ void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv)
|
||||
pxmitbuf++;
|
||||
}
|
||||
|
||||
if (pxmitpriv->pallocated_frame_buf)
|
||||
rtw_vmfree(pxmitpriv->pallocated_frame_buf, NR_XMITFRAME * sizeof(struct xmit_frame) + 4);
|
||||
vfree(pxmitpriv->pallocated_frame_buf);
|
||||
|
||||
|
||||
if (pxmitpriv->pallocated_xmitbuf)
|
||||
rtw_vmfree(pxmitpriv->pallocated_xmitbuf, NR_XMITBUFF * sizeof(struct xmit_buf) + 4);
|
||||
vfree(pxmitpriv->pallocated_xmitbuf);
|
||||
|
||||
/* free xframe_ext queue, the same count as extbuf */
|
||||
if ((pxmitframe = (struct xmit_frame *)pxmitpriv->xframe_ext)) {
|
||||
@ -419,8 +417,8 @@ void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv)
|
||||
pxmitframe++;
|
||||
}
|
||||
}
|
||||
if (pxmitpriv->xframe_ext_alloc_addr)
|
||||
rtw_vmfree(pxmitpriv->xframe_ext_alloc_addr, NR_XMIT_EXTBUFF * sizeof(struct xmit_frame) + 4);
|
||||
|
||||
vfree(pxmitpriv->xframe_ext_alloc_addr);
|
||||
_rtw_spinlock_free(&pxmitpriv->free_xframe_ext_queue.lock);
|
||||
|
||||
/* free xmit extension buff */
|
||||
@ -433,8 +431,7 @@ void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv)
|
||||
pxmitbuf++;
|
||||
}
|
||||
|
||||
if (pxmitpriv->pallocated_xmit_extbuf)
|
||||
rtw_vmfree(pxmitpriv->pallocated_xmit_extbuf, NR_XMIT_EXTBUFF * sizeof(struct xmit_buf) + 4);
|
||||
vfree(pxmitpriv->pallocated_xmit_extbuf);
|
||||
|
||||
for (i = 0; i < CMDBUF_MAX; i++) {
|
||||
pxmitbuf = &pxmitpriv->pcmd_xmitbuf[i];
|
||||
|
@ -4702,7 +4702,7 @@ void rtw_dump_rsvd_page(void *sel, _adapter *adapter, u8 page_offset, u8 page_nu
|
||||
if (buffer) {
|
||||
rtw_hal_get_rsvd_page(adapter, page_offset, page_num, buffer, buf_size);
|
||||
RTW_DUMP_SEL(sel, buffer, buf_size);
|
||||
rtw_vmfree(buffer, buf_size);
|
||||
vfree(buffer);
|
||||
} else
|
||||
RTW_PRINT_SEL(sel, "ERROR - rsvd_buf mem allocate failed\n");
|
||||
} else
|
||||
@ -4739,7 +4739,7 @@ void rtw_dump_fifo(void *sel, _adapter *adapter, u8 fifo_sel, u32 fifo_addr, u32
|
||||
|
||||
if (buffer) {
|
||||
RTW_DUMP_SEL(sel, buffer, fifo_size);
|
||||
rtw_vmfree(buffer, buff_size);
|
||||
vfree(buffer);
|
||||
}
|
||||
|
||||
RTW_PRINT_SEL(sel, "==========================\n");
|
||||
@ -5224,7 +5224,7 @@ static void rtw_hal_get_aoac_rpt(_adapter *adapter)
|
||||
|
||||
_exit:
|
||||
if (buffer)
|
||||
rtw_vmfree(buffer, buf_size);
|
||||
vfree(buffer);
|
||||
}
|
||||
|
||||
static void rtw_hal_update_tx_iv(_adapter *adapter)
|
||||
|
@ -5359,43 +5359,43 @@ void phy_free_filebuf_mask(_adapter *padapter, u8 mask)
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
|
||||
if (pHalData->mac_reg && (mask & LOAD_MAC_PARA_FILE)) {
|
||||
rtw_vmfree(pHalData->mac_reg, pHalData->mac_reg_len);
|
||||
vfree(pHalData->mac_reg);
|
||||
pHalData->mac_reg = NULL;
|
||||
}
|
||||
if (mask & LOAD_BB_PARA_FILE) {
|
||||
if (pHalData->bb_phy_reg) {
|
||||
rtw_vmfree(pHalData->bb_phy_reg, pHalData->bb_phy_reg_len);
|
||||
vfree(pHalData->bb_phy_reg);
|
||||
pHalData->bb_phy_reg = NULL;
|
||||
}
|
||||
if (pHalData->bb_agc_tab) {
|
||||
rtw_vmfree(pHalData->bb_agc_tab, pHalData->bb_agc_tab_len);
|
||||
vfree(pHalData->bb_agc_tab);
|
||||
pHalData->bb_agc_tab = NULL;
|
||||
}
|
||||
}
|
||||
if (pHalData->bb_phy_reg_pg && (mask & LOAD_BB_PG_PARA_FILE)) {
|
||||
rtw_vmfree(pHalData->bb_phy_reg_pg, pHalData->bb_phy_reg_pg_len);
|
||||
vfree(pHalData->bb_phy_reg_pg);
|
||||
pHalData->bb_phy_reg_pg = NULL;
|
||||
}
|
||||
if (pHalData->bb_phy_reg_mp && (mask & LOAD_BB_MP_PARA_FILE)) {
|
||||
rtw_vmfree(pHalData->bb_phy_reg_mp, pHalData->bb_phy_reg_mp_len);
|
||||
vfree(pHalData->bb_phy_reg_mp);
|
||||
pHalData->bb_phy_reg_mp = NULL;
|
||||
}
|
||||
if (mask & LOAD_RF_PARA_FILE) {
|
||||
if (pHalData->rf_radio_a) {
|
||||
rtw_vmfree(pHalData->rf_radio_a, pHalData->rf_radio_a_len);
|
||||
vfree(pHalData->rf_radio_a);
|
||||
pHalData->rf_radio_a = NULL;
|
||||
}
|
||||
if (pHalData->rf_radio_b) {
|
||||
rtw_vmfree(pHalData->rf_radio_b, pHalData->rf_radio_b_len);
|
||||
vfree(pHalData->rf_radio_b);
|
||||
pHalData->rf_radio_b = NULL;
|
||||
}
|
||||
}
|
||||
if (pHalData->rf_tx_pwr_track && (mask & LOAD_RF_TXPWR_TRACK_PARA_FILE)) {
|
||||
rtw_vmfree(pHalData->rf_tx_pwr_track, pHalData->rf_tx_pwr_track_len);
|
||||
vfree(pHalData->rf_tx_pwr_track);
|
||||
pHalData->rf_tx_pwr_track = NULL;
|
||||
}
|
||||
if (pHalData->rf_tx_pwr_lmt && (mask & LOAD_RF_TXPWR_LMT_PARA_FILE)) {
|
||||
rtw_vmfree(pHalData->rf_tx_pwr_lmt, pHalData->rf_tx_pwr_lmt_len);
|
||||
vfree(pHalData->rf_tx_pwr_lmt);
|
||||
pHalData->rf_tx_pwr_lmt = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -4414,7 +4414,7 @@ int rtw_halmac_dump_fifo(struct dvobj_priv *d, u8 fifo_sel, u32 addr, u32 size,
|
||||
|
||||
_exit:
|
||||
if ((mem_created == _TRUE) && pfifo_map)
|
||||
rtw_vmfree(pfifo_map, fifo_size);
|
||||
vfree(pfifo_map);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ void rtw_hal_data_deinit(_adapter *padapter)
|
||||
#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
|
||||
phy_free_filebuf(padapter);
|
||||
#endif
|
||||
rtw_vmfree(padapter->HalData, padapter->hal_data_sz);
|
||||
vfree(padapter->HalData);
|
||||
padapter->HalData = NULL;
|
||||
padapter->hal_data_sz = 0;
|
||||
}
|
||||
|
@ -389,12 +389,12 @@ void odm_free_memory(struct dm_struct *dm, void *ptr, u32 length)
|
||||
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE) && defined(DM_ODM_CE_MAC80211_V2)
|
||||
kfree(ptr);
|
||||
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
||||
rtw_vmfree(ptr, length);
|
||||
vfree(ptr);
|
||||
#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
|
||||
/* struct void* adapter = dm->adapter; */
|
||||
PlatformFreeMemory(ptr, length);
|
||||
#elif (DM_ODM_SUPPORT_TYPE & ODM_IOT)
|
||||
rtw_vmfree(ptr, length);
|
||||
vfree(ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -170,14 +170,12 @@ void dbg_rtw_usb_buffer_free(struct usb_device *dev, size_t size, void *addr, dm
|
||||
#ifdef CONFIG_USE_VMALLOC
|
||||
#define rtw_vmalloc(sz) dbg_rtw_vmalloc((sz), MSTAT_TYPE_VIR, __FUNCTION__, __LINE__)
|
||||
#define rtw_zvmalloc(sz) dbg_rtw_zvmalloc((sz), MSTAT_TYPE_VIR, __FUNCTION__, __LINE__)
|
||||
#define rtw_vmfree(pbuf, sz) dbg_rtw_vmfree((pbuf), (sz), MSTAT_TYPE_VIR, __FUNCTION__, __LINE__)
|
||||
#define rtw_vmalloc_f(sz, mstat_f) dbg_rtw_vmalloc((sz), ((mstat_f) & 0xff00) | MSTAT_TYPE_VIR, __FUNCTION__, __LINE__)
|
||||
#define rtw_zvmalloc_f(sz, mstat_f) dbg_rtw_zvmalloc((sz), ((mstat_f) & 0xff00) | MSTAT_TYPE_VIR, __FUNCTION__, __LINE__)
|
||||
#define rtw_vmfree_f(pbuf, sz, mstat_f) dbg_rtw_vmfree((pbuf), (sz), ((mstat_f) & 0xff00) | MSTAT_TYPE_VIR, __FUNCTION__, __LINE__)
|
||||
#else /* CONFIG_USE_VMALLOC */
|
||||
#define rtw_vmalloc(sz) dbg_rtw_malloc((sz), MSTAT_TYPE_PHY, __FUNCTION__, __LINE__)
|
||||
#define rtw_zvmalloc(sz) dbg_rtw_zmalloc((sz), MSTAT_TYPE_PHY, __FUNCTION__, __LINE__)
|
||||
#define rtw_vmfree(pbuf, sz) dbg_rtw_mfree((pbuf), (sz), MSTAT_TYPE_PHY, __FUNCTION__, __LINE__)
|
||||
#define rtw_vmalloc_f(sz, mstat_f) dbg_rtw_malloc((sz), ((mstat_f) & 0xff00) | MSTAT_TYPE_PHY, __FUNCTION__, __LINE__)
|
||||
#define rtw_zvmalloc_f(sz, mstat_f) dbg_rtw_zmalloc((sz), ((mstat_f) & 0xff00) | MSTAT_TYPE_PHY, __FUNCTION__, __LINE__)
|
||||
#define rtw_vmfree_f(pbuf, sz, mstat_f) dbg_rtw_mfree((pbuf), (sz), ((mstat_f) & 0xff00) | MSTAT_TYPE_PHY, __FUNCTION__, __LINE__)
|
||||
@ -218,7 +216,6 @@ void dbg_rtw_usb_buffer_free(struct usb_device *dev, size_t size, void *addr, dm
|
||||
#define match_mstat_sniff_rules(flags, size) _FALSE
|
||||
void *_rtw_vmalloc(u32 sz);
|
||||
void *_rtw_zvmalloc(u32 sz);
|
||||
void _rtw_vmfree(void *pbuf, u32 sz);
|
||||
void *_rtw_zmalloc(u32 sz);
|
||||
void *_rtw_malloc(u32 sz);
|
||||
void _rtw_mfree(void *pbuf, u32 sz);
|
||||
@ -244,14 +241,12 @@ void _rtw_usb_buffer_free(struct usb_device *dev, size_t size, void *addr, dma_a
|
||||
#ifdef CONFIG_USE_VMALLOC
|
||||
#define rtw_vmalloc(sz) _rtw_vmalloc((sz))
|
||||
#define rtw_zvmalloc(sz) _rtw_zvmalloc((sz))
|
||||
#define rtw_vmfree(pbuf, sz) _rtw_vmfree((pbuf), (sz))
|
||||
#define rtw_vmalloc_f(sz, mstat_f) _rtw_vmalloc((sz))
|
||||
#define rtw_zvmalloc_f(sz, mstat_f) _rtw_zvmalloc((sz))
|
||||
#define rtw_vmfree_f(pbuf, sz, mstat_f) _rtw_vmfree((pbuf), (sz))
|
||||
#else /* CONFIG_USE_VMALLOC */
|
||||
#define rtw_vmalloc(sz) _rtw_malloc((sz))
|
||||
#define rtw_zvmalloc(sz) _rtw_zmalloc((sz))
|
||||
#define rtw_vmfree(pbuf, sz) _rtw_mfree((pbuf), (sz))
|
||||
#define rtw_vmalloc_f(sz, mstat_f) _rtw_malloc((sz))
|
||||
#define rtw_zvmalloc_f(sz, mstat_f) _rtw_zmalloc((sz))
|
||||
#define rtw_vmfree_f(pbuf, sz, mstat_f) _rtw_mfree((pbuf), (sz))
|
||||
|
@ -7875,7 +7875,7 @@ static int rtw_wx_set_priv(struct net_device *dev,
|
||||
return -ENOMEM;
|
||||
|
||||
if (copy_from_user(ext, dwrq->pointer, len)) {
|
||||
rtw_vmfree(ext, len);
|
||||
vfree(ext);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
@ -7884,7 +7884,7 @@ static int rtw_wx_set_priv(struct net_device *dev,
|
||||
#ifdef CONFIG_DEBUG_RTW_WX_SET_PRIV
|
||||
ext_dbg = rtw_vmalloc(len);
|
||||
if (!ext_dbg) {
|
||||
rtw_vmfree(ext, len);
|
||||
vfree(ext);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -8004,9 +8004,9 @@ static int rtw_wx_set_priv(struct net_device *dev,
|
||||
|
||||
FREE_EXT:
|
||||
|
||||
rtw_vmfree(ext, len);
|
||||
vfree(ext);
|
||||
#ifdef CONFIG_DEBUG_RTW_WX_SET_PRIV
|
||||
rtw_vmfree(ext_dbg, len);
|
||||
vfree(ext_dbg);
|
||||
#endif
|
||||
|
||||
/* RTW_INFO("rtw_wx_set_priv: (SIOCSIWPRIV) %s ret=%d\n", */
|
||||
|
@ -2898,7 +2898,7 @@ free_drv_sw:
|
||||
rtw_free_drv_sw(padapter);
|
||||
free_adapter:
|
||||
if (res != _SUCCESS && padapter) {
|
||||
rtw_vmfree((u8 *)padapter, sizeof(*padapter));
|
||||
vfree((u8 *)padapter);
|
||||
padapter = NULL;
|
||||
}
|
||||
exit:
|
||||
@ -2958,7 +2958,7 @@ void rtw_drv_free_vir_if(_adapter *padapter)
|
||||
/* TODO: use rtw_os_ndevs_deinit instead at the first stage of driver's dev deinit function */
|
||||
rtw_os_ndev_free(padapter);
|
||||
|
||||
rtw_vmfree((u8 *)padapter, sizeof(_adapter));
|
||||
vfree(padapter);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1399,7 +1399,7 @@ free_adapter:
|
||||
#ifdef RTW_HALMAC
|
||||
rtw_halmac_deinit_adapter(dvobj);
|
||||
#endif
|
||||
rtw_vmfree((u8 *)padapter, sizeof(*padapter));
|
||||
vfree((u8 *)padapter);
|
||||
padapter = NULL;
|
||||
}
|
||||
exit:
|
||||
@ -1459,7 +1459,7 @@ static void rtw_usb_primary_adapter_deinit(_adapter *padapter)
|
||||
rtw_halmac_deinit_adapter(adapter_to_dvobj(padapter));
|
||||
#endif /* RTW_HALMAC */
|
||||
|
||||
rtw_vmfree((u8 *)padapter, sizeof(_adapter));
|
||||
vfree(padapter);
|
||||
|
||||
#ifdef CONFIG_PLATFORM_RTD2880B
|
||||
RTW_INFO("wlan link down\n");
|
||||
|
@ -111,26 +111,6 @@ inline void *_rtw_zvmalloc(u32 sz)
|
||||
return pbuf;
|
||||
}
|
||||
|
||||
inline void _rtw_vmfree(void *pbuf, u32 sz)
|
||||
{
|
||||
#ifdef PLATFORM_LINUX
|
||||
vfree(pbuf);
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
free(pbuf, M_DEVBUF);
|
||||
#endif
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
NdisFreeMemory(pbuf, sz, 0);
|
||||
#endif
|
||||
|
||||
#ifdef DBG_MEMORY_LEAK
|
||||
#ifdef PLATFORM_LINUX
|
||||
atomic_dec(&_malloc_cnt);
|
||||
atomic_sub(sz, &_malloc_size);
|
||||
#endif
|
||||
#endif /* DBG_MEMORY_LEAK */
|
||||
}
|
||||
|
||||
void *_rtw_malloc(u32 sz)
|
||||
{
|
||||
void *pbuf = NULL;
|
||||
@ -602,7 +582,7 @@ inline void dbg_rtw_vmfree(void *pbuf, u32 sz, const enum mstat_f flags, const c
|
||||
if (match_mstat_sniff_rules(flags, sz))
|
||||
RTW_INFO("DBG_MEM_ALLOC %s:%d %s(%d)\n", func, line, __FUNCTION__, (sz));
|
||||
|
||||
_rtw_vmfree((pbuf), (sz));
|
||||
vfree((pbuf));
|
||||
|
||||
rtw_mstat_update(
|
||||
flags
|
||||
|
Loading…
Reference in New Issue
Block a user