All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] staging: rtl8723bs: remove meaningless pstat->passoc_req check in OnAssocReq()
@ 2021-09-28  6:13 Longji Guo
  2021-09-28  6:56 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Longji Guo @ 2021-09-28  6:13 UTC (permalink / raw)
  To: gregkh, fabioaiuto83
  Cc: ross.schm.dev, marcocesati, hdegoede, fmdefrancesco,
	linux-staging, linux-kernel, Longji Guo

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, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 375d2a742dd2..51390a30fa55 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -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);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH v2] staging: rtl8723bs: remove meaningless pstat->passoc_req check in OnAssocReq()
@ 2021-09-29 11:06 Longji Guo
  2021-09-29 11:33 ` Hans de Goede
  0 siblings, 1 reply; 4+ messages in thread
From: Longji Guo @ 2021-09-29 11:06 UTC (permalink / raw)
  To: gregkh, fabioaiuto83
  Cc: ross.schm.dev, marcocesati, hdegoede, fmdefrancesco,
	linux-staging, linux-kernel, Longji Guo

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

Signed-off-by: Longji Guo <guolongji@uniontech.com>
---
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(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 375d2a742dd2..51390a30fa55 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -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);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-29 11:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-28  6:13 [PATCH v2] staging: rtl8723bs: remove meaningless pstat->passoc_req check in OnAssocReq() Longji Guo
2021-09-28  6:56 ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2021-09-29 11:06 Longji Guo
2021-09-29 11:33 ` Hans de Goede

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.