Skip to contentSkip to conversation

staging: rtl8723bs: remove meaningless pstat->passoc_req check in OnAssocReq()

PATCH In review Longji Guo 2 participants 2 messages Sep 29, 2021 Staging

lore
Share & tools
lore

Longji Guo

author
#0 lore raw

PATCH v2 1/1 staging: rtl8723bs: remove meaningless pstat->passoc_req check in OnAssocReq()

kfree(NULL) is safe and the check 'if (pstat->passoc_req)' before kfree is not necessary.

---
Changes in v2:
- Drop unnecessary "pstat->passoc_req = NULL;"

---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +2 -6
index 375d2a742dd2..51390a30fa55 100644
@@ -1344,12 +1344,8 @@ 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->assoc_req_len = 0;
 		pstat->passoc_req =  rtw_zmalloc(pkt_len);
 		if (pstat->passoc_req) {
 			memcpy(pstat->passoc_req, pframe, pkt_len);
Signature · 1 line
2.20.1
Reviewed-by on v2 1/1
#1 lore raw

Hi,

Quoted 7 lines · Longji Guo

kfree(NULL) is safe and the check 'if (pstat->passoc_req)' before kfree is not necessary.

---
Changes in v2:
- Drop unnecessary "pstat->passoc_req = NULL;"

Thanks, patch looks good to me:

Regards,

Hans

Quoted 24 lines
---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +2 -6
index 375d2a742dd2..51390a30fa55 100644
@@ -1344,12 +1344,8 @@ 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->assoc_req_len = 0;
 		pstat->passoc_req =  rtw_zmalloc(pkt_len);
 		if (pstat->passoc_req) {
 			memcpy(pstat->passoc_req, pframe, pkt_len);