Skip to contentSkip to conversation

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

PATCH In review guolongji 3 participants 3 messages Sep 26, 2021 Staging

lore
Share & tools
lore

guolongji

author
#0 lore raw

PATCH 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 possible.

---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +3 -5
index 375d2a742dd2..a46ab97524aa 100644
@@ -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;
+		pstat->assoc_req_len = 0;
 
 		pstat->passoc_req =  rtw_zmalloc(pkt_len);
 		if (pstat->passoc_req) {
Signature · 1 line
2.20.1
#1 lore raw
Quoted 5 lines · CEST guolongji

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

---

Why is it "not possible"? Do you get syntax errors? Are the logic and the result of the function altered? If not, control is certainly "possible".

Remember that something may be unnecessary and redundant even if it is still possible.

Regards,

Fabio

maintainer
#2 lore raw
In reply to guolongji
Quoted 4 lines · guolongji

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

We need a "full" or "real" name here. Do you really sign documents with a lower-case "g" like this? If so, great, just have to check.

thanks,

greg k-h