Skip to contentSkip to conversation

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

PATCH In review Longji Guo 3 participants 3 messages Sep 27, 2021 Staging

lore
Share & tools
lore

Longji Guo

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 necessary.

---
 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

Hi,

Quoted 13 lines · Longji Guo

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

---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +0 -0
index 375d2a742dd2..a46ab97524aa 100644

drivers/staging/rtl8723bs/core/rtw_mlme_ext.c unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) · line 1348

Quoted 10 lines
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +2 -5
@@ -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

Quoted 5 lines
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +1 -0
+		pstat->assoc_req_len = 0;
 
 		pstat->passoc_req =  rtw_zmalloc(pkt_len);
 		if (pstat->passoc_req) {
maintainer
#2 lore raw
In reply to Longji Guo
Quoted 30 lines · Longji Guo

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

---
 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

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.

You are receiving this message because of the following common error(s) as indicated below:

- This looks like a new version of a previously submitted patch, but you did not list below the --- line any changes from the previous version. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what needs to be done here to properly describe this.

If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.

thanks,

greg k-h's patch email bot