lkml.org 
[lkml]   [2021]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] staging: rtl8723bs: remove meaningless pstat->passoc_req check in OnAssocReq()
From
Date
Hi,

On 9/27/21 5:30 AM, Longji Guo wrote:
> kfree(NULL) is safe and the check 'if (pstat->passoc_req)' before kfree
> is not necessary.
>
> Signed-off-by: Longji Guo <guolongji@uniontech.com>
> ---
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> index 375d2a742dd2..a46ab97524aa 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> @@ -1344,11 +1344,9 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
> issue_asocrsp(padapter, status, pstat, WIFI_REASSOCRSP);
>
> spin_lock_bh(&pstat->lock);
> - if (pstat->passoc_req) {
> - kfree(pstat->passoc_req);
> - pstat->passoc_req = NULL;
> - pstat->assoc_req_len = 0;
> - }
> + kfree(pstat->passoc_req);
> + pstat->passoc_req = NULL;

This "pstat->passoc_req = NULL;" is not necessary, since directly afterwards
pstat->passoc_req gets overwritten with the return value from rtw_zmalloc()
so please drop this line too.

Regards,

Hans



> + pstat->assoc_req_len = 0;
>
> pstat->passoc_req = rtw_zmalloc(pkt_len);
> if (pstat->passoc_req) {
>

\
 
 \ /
  Last update: 2021-09-27 10:28    [W:0.040 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site