This routine is just a wrapper around kfree(). The wrapper also sets buffer length to 0, and the pointer to NULL. The length variable is in the struct to be freed, thus setting it to zero is meaningless. Setting the pointer to NULL is also not needed. Signed-off-by: Larry Finger <Larry.Finger@xxxxxxxxxxxx> --- drivers/staging/r8188eu/core/rtw_mlme.c | 4 ++-- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 9 ++++----- drivers/staging/r8188eu/include/osdep_service.h | 1 - drivers/staging/r8188eu/os_dep/osdep_service.c | 7 ------- 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c index 4ffed8a35054..e3d5a721d25c 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme.c +++ b/drivers/staging/r8188eu/core/rtw_mlme.c @@ -99,8 +99,8 @@ static void rtw_free_mlme_ie_data(u8 **ppie, u32 *plen) void rtw_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv) { - rtw_buf_free(&pmlmepriv->assoc_req, &pmlmepriv->assoc_req_len); - rtw_buf_free(&pmlmepriv->assoc_rsp, &pmlmepriv->assoc_rsp_len); + kfree(pmlmepriv->assoc_req); + kfree(pmlmepriv->assoc_rsp); rtw_free_mlme_ie_data(&pmlmepriv->wps_beacon_ie, &pmlmepriv->wps_beacon_ie_len); rtw_free_mlme_ie_data(&pmlmepriv->wps_probe_req_ie, &pmlmepriv->wps_probe_req_ie_len); rtw_free_mlme_ie_data(&pmlmepriv->wps_probe_resp_ie, &pmlmepriv->wps_probe_resp_ie_len); diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index a8ed4e1a0278..470c338b44e1 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -1519,11 +1519,10 @@ unsigned int OnAssocRsp(struct adapter *padapter, struct recv_frame *precv_frame UpdateBrateTbl(padapter, pmlmeinfo->network.SupportedRates); report_assoc_result: - if (res > 0) { + if (res > 0) rtw_buf_update(&pmlmepriv->assoc_rsp, &pmlmepriv->assoc_rsp_len, pframe, pkt_len); - } else { - rtw_buf_free(&pmlmepriv->assoc_rsp, &pmlmepriv->assoc_rsp_len); - } + else + kfree(pmlmepriv->assoc_rsp); report_join_res(padapter, res); @@ -5534,7 +5533,7 @@ void issue_assocreq(struct adapter *padapter) if (ret == _SUCCESS) rtw_buf_update(&pmlmepriv->assoc_req, &pmlmepriv->assoc_req_len, (u8 *)pwlanhdr, pattrib->pktlen); else - rtw_buf_free(&pmlmepriv->assoc_req, &pmlmepriv->assoc_req_len); + kfree(pmlmepriv->assoc_req); } /* when wait_ack is ture, this function shoule be called at process context */ diff --git a/drivers/staging/r8188eu/include/osdep_service.h b/drivers/staging/r8188eu/include/osdep_service.h index cb876b50d68c..10f0203fd905 100644 --- a/drivers/staging/r8188eu/include/osdep_service.h +++ b/drivers/staging/r8188eu/include/osdep_service.h @@ -370,7 +370,6 @@ void rtw_free_netdev(struct net_device *netdev); (a)[3] = (u8) (((u32) (val)) & 0xff); \ } while (0) -void rtw_buf_free(u8 **buf, u32 *buf_len); void rtw_buf_update(u8 **buf, u32 *buf_len, u8 *src, u32 src_len); struct rtw_cbuf { diff --git a/drivers/staging/r8188eu/os_dep/osdep_service.c b/drivers/staging/r8188eu/os_dep/osdep_service.c index db6ee1dca48e..232d3a337be4 100644 --- a/drivers/staging/r8188eu/os_dep/osdep_service.c +++ b/drivers/staging/r8188eu/os_dep/osdep_service.c @@ -283,13 +283,6 @@ int rtw_change_ifname(struct adapter *padapter, const char *ifname) return -1; } -void rtw_buf_free(u8 **buf, u32 *buf_len) -{ - *buf_len = 0; - kfree(*buf); - *buf = NULL; -} - void rtw_buf_update(u8 **buf, u32 *buf_len, u8 *src, u32 src_len) { u32 dup_len = 0; -- 2.32.0