Skip to contentSkip to conversation

staging: rtl8723bs: add initial value

PATCH In review Hao Peng 2 participants 2 messages Mar 11, 2021 – Mar 12, 2021 Staging

lore
Share & tools
lore

Hao Peng

author
#0 lore raw

PATCH 1/1 staging: rtl8723bs: add initial value

Add initial value for some uninitialized variable and array.

---
 drivers/staging/rtl8723bs/core/rtw_ap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ap.c +3 -3
index b6f944b37b08..ceea160db38a 100644
@@ -206,8 +206,8 @@ void expire_timeout_chk(struct adapter *padapter)
 	struct sta_info *psta = NULL;
 	struct sta_priv *pstapriv = &padapter->stapriv;
 	u8 chk_alive_num = 0;
-	char chk_alive_list[NUM_STA];
-	int i;
+	char chk_alive_list[NUM_STA] = {0};
+	int i = 0;
 
 	spin_lock_bh(&pstapriv->auth_list_lock);
 
@@ -308,7 +308,7 @@ void expire_timeout_chk(struct adapter *padapter)
 				}
 			}
 			if (pmlmeext->active_keep_alive_check) {
-				int stainfo_offset;
+				int stainfo_offset = 0;
 
 				stainfo_offset = rtw_stainfo_offset(pstapriv, psta);
 				if (stainfo_offset_valid(stainfo_offset))
Signature · 1 line
2.20.1
#1 lore raw
Quoted 2 lines · Hao Peng

Add initial value for some uninitialized variable and array.

None of these are ever used uninitialized. It's weird that you would even think that.

drivers/staging/rtl8723bs/core/rtw_ap.c void expire_timeout_chk(struct adapter *padapter) · line 313

Quoted 5 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +1 -1
 			if (pmlmeext->active_keep_alive_check) {
-				int stainfo_offset;
+				int stainfo_offset = 0;
 
 				stainfo_offset = rtw_stainfo_offset(pstapriv, psta);
                                ^^^^^^^^^^^^^^^^

This one is initialized on the very next line so all the patch does is introduce static checker warnings for no reason.

regards,
dan carpenter