Clear several unused local variable warnings
cover Clear several unused local variable warnings
No functional change.
Zhen Lei (2):
staging: rtl8723bs: core: remove three unused local variable
staging: rtl8723bs: core: eliminate erroneous reporting of unused
variable 'evt_seq'
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 53 ++++++------------- 1 file changed, 16 insertions(+), 37 deletions(-)
Signature · 1 line
2.26.0.106.g9fadedd
PATCH 1/2 staging: rtl8723bs: core: remove three unused local variables
Commit 968b15adb0ea ("staging: rtl8723bs: remove all DBG_871X logs") removed all of the DBG_871X logs, so no one uses local variable 'reassoc', 'reason_code' and 'psta' anymore.
--- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 31 +++---------------- 1 file changed, 5 insertions(+), 26 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +5 -26
@@ -1021,7 +1021,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)u16 capab_info;struct rtw_ieee802_11_elems elems;struct sta_info *pstat; -unsigned char reassoc, *p, *pos, *wpa_ie; +unsigned char *p, *pos, *wpa_ie;unsigned char WMM_IE [] = {0x00 ,0x50 ,0xf2 ,0x02 ,0x00 ,0x01 };int i, ie_len, wpa_ie_len, left;unsigned char supportRate[16 ];
@@ -1041,14 +1041,10 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)return _FAIL; frame_type =GetFrameSubType (pframe); -if (frame_type ==WIFI_ASSOCREQ ) { - reassoc =0 ; +if (frame_type ==WIFI_ASSOCREQ ) ie_offset = _ASOCREQ_IE_OFFSET_; - }else {/* WIFI_REASSOCREQ */ - reassoc =1 ; +else /* WIFI_REASSOCREQ */ ie_offset = _REASOCREQ_IE_OFFSET_; - } -if (pkt_len <sizeof (struct ieee80211_hdr_3addr ) + ie_offset)return _FAIL;
@@ -1726,7 +1722,7 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_frastruct recv_reorder_ctrl *preorder_ctrl;unsigned char *frame_body;unsigned char category, action; -unsigned short tid, status, reason_code =0 ; +unsigned short tid, status;struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);u8 *pframe = precv_frame->u.hdr.rx_data;
@@ -1795,9 +1791,6 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra ~BIT ((frame_body[3 ] >>4 ) &0xf ); psta->htpriv.candidate_tid_bitmap &= ~BIT ((frame_body[3 ] >>4 ) &0xf ); - -/* reason_code = frame_body[4] | (frame_body[5] << 8); */ - reason_code =get_unaligned_le16 (&frame_body[4 ]); }else if ((frame_body[3 ] &BIT (3 )) ==BIT (3 )) { tid = (frame_body[3 ] >>4 ) &0x0F ;
@@ -5127,22 +5120,8 @@ void _linked_info_dump(struct adapter *padapter)if ((pmlmeinfo->state&0x03 ) ==WIFI_FW_STATION_STATE ) {rtw_hal_get_def_var (padapter,HAL_DEF_UNDERCORATEDSMOOTHEDPWDB , &UndecoratedSmoothedPWDB); - }else if ((pmlmeinfo->state&0x03 ) == _HW_STATE_AP_) { -struct list_head *phead, *plist; - -struct sta_info *psta =NULL ; -struct sta_priv *pstapriv = &padapter->stapriv; - -spin_lock_bh (&pstapriv->asoc_list_lock); - phead = &pstapriv->asoc_list; - plist =get_next (phead); -while (phead != plist) { - psta = container_of(plist, struct sta_info, asoc_list); - plist =get_next (plist); - } -spin_unlock_bh (&pstapriv->asoc_list_lock); - } +for (i =0 ; i <NUM_STA ; i++) {if (pdvobj->macid[i]) {if (i !=1 )/* skip bc/mc sta */
Signature · 1 line
2.26.0.106.g9fadedd
Greg Kroah-Hartman
maintainerRe: [PATCH 1/2] staging: rtl8723bs: core: remove three unused local variables
Quoted 89 lines · Zhen Lei
Commit
968b15adb0ea("staging: rtl8723bs: remove allDBG_871Xlogs") removed all of theDBG_871Xlogs, so no one uses local variable 'reassoc', 'reason_code' and 'psta' anymore.Fixes 968b15adb0ea ("staging: rtl8723bs: remove all DBG_871X logs")Reported-by Hulk Robot <[email protected]>Signed-off-by Zhen Lei <[email protected]>--- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 31 +++---------------- 1 file changed, 5 insertions(+), 26 deletions(-)drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +5
-26@@ -1021,7 +1021,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)u16 capab_info;struct rtw_ieee802_11_elems elems;struct sta_info *pstat; -unsigned char reassoc, *p, *pos, *wpa_ie; +unsigned char *p, *pos, *wpa_ie;unsigned char WMM_IE [] = {0x00 ,0x50 ,0xf2 ,0x02 ,0x00 ,0x01 };int i, ie_len, wpa_ie_len, left;unsigned char supportRate[16 ];@@ -1041,14 +1041,10 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)return _FAIL; frame_type =GetFrameSubType (pframe); -if (frame_type ==WIFI_ASSOCREQ ) { - reassoc =0 ; +if (frame_type ==WIFI_ASSOCREQ ) ie_offset = _ASOCREQ_IE_OFFSET_; - }else {/* WIFI_REASSOCREQ */ - reassoc =1 ; +else /* WIFI_REASSOCREQ */ ie_offset = _REASOCREQ_IE_OFFSET_; - } -if (pkt_len <sizeof (struct ieee80211_hdr_3addr ) + ie_offset)return _FAIL;@@ -1726,7 +1722,7 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_frastruct recv_reorder_ctrl *preorder_ctrl;unsigned char *frame_body;unsigned char category, action; -unsigned short tid, status, reason_code =0 ; +unsigned short tid, status;struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);u8 *pframe = precv_frame->u.hdr.rx_data;@@ -1795,9 +1791,6 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra ~BIT ((frame_body[3 ] >>4 ) &0xf ); psta->htpriv.candidate_tid_bitmap &= ~BIT ((frame_body[3 ] >>4 ) &0xf ); - -/* reason_code = frame_body[4] | (frame_body[5] << 8); */ - reason_code =get_unaligned_le16 (&frame_body[4 ]); }else if ((frame_body[3 ] &BIT (3 )) ==BIT (3 )) { tid = (frame_body[3 ] >>4 ) &0x0F ;@@ -5127,22 +5120,8 @@ void _linked_info_dump(struct adapter *padapter)if ((pmlmeinfo->state&0x03 ) ==WIFI_FW_STATION_STATE ) {rtw_hal_get_def_var (padapter,HAL_DEF_UNDERCORATEDSMOOTHEDPWDB , &UndecoratedSmoothedPWDB); - }else if ((pmlmeinfo->state&0x03 ) == _HW_STATE_AP_) { -struct list_head *phead, *plist; - -struct sta_info *psta =NULL ; -struct sta_priv *pstapriv = &padapter->stapriv; - -spin_lock_bh (&pstapriv->asoc_list_lock); - phead = &pstapriv->asoc_list; - plist =get_next (phead); -while (phead != plist) { - psta = container_of(plist, struct sta_info, asoc_list); - plist =get_next (plist); - } -spin_unlock_bh (&pstapriv->asoc_list_lock); - } +for (i =0 ; i <NUM_STA ; i++) {if (pdvobj->macid[i]) {if (i !=1 )/* skip bc/mc sta */ Signature · 1 line
2.26.0.106.g9fadedd
Does not apply to my tree :(
Re: [PATCH 1/2] staging: rtl8723bs: core: remove three unused local variables
Quoted 84 lines · Greg Kroah-Hartman
Quoted 83 lines · Zhen Lei
Commit
968b15adb0ea("staging: rtl8723bs: remove allDBG_871Xlogs") removed all of theDBG_871Xlogs, so no one uses local variable 'reassoc', 'reason_code' and 'psta' anymore.Fixes 968b15adb0ea ("staging: rtl8723bs: remove all DBG_871X logs")Reported-by Hulk Robot <[email protected]>Signed-off-by Zhen Lei <[email protected]>--- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 31 +++---------------- 1 file changed, 5 insertions(+), 26 deletions(-)drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +5
-26@@ -1021,7 +1021,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)u16 capab_info;struct rtw_ieee802_11_elems elems;struct sta_info *pstat; -unsigned char reassoc, *p, *pos, *wpa_ie; +unsigned char *p, *pos, *wpa_ie;unsigned char WMM_IE [] = {0x00 ,0x50 ,0xf2 ,0x02 ,0x00 ,0x01 };int i, ie_len, wpa_ie_len, left;unsigned char supportRate[16 ];@@ -1041,14 +1041,10 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)return _FAIL; frame_type =GetFrameSubType (pframe); -if (frame_type ==WIFI_ASSOCREQ ) { - reassoc =0 ; +if (frame_type ==WIFI_ASSOCREQ ) ie_offset = _ASOCREQ_IE_OFFSET_; - }else {/* WIFI_REASSOCREQ */ - reassoc =1 ; +else /* WIFI_REASSOCREQ */ ie_offset = _REASOCREQ_IE_OFFSET_; - } -if (pkt_len <sizeof (struct ieee80211_hdr_3addr ) + ie_offset)return _FAIL;@@ -1726,7 +1722,7 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_frastruct recv_reorder_ctrl *preorder_ctrl;unsigned char *frame_body;unsigned char category, action; -unsigned short tid, status, reason_code =0 ; +unsigned short tid, status;struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);u8 *pframe = precv_frame->u.hdr.rx_data;@@ -1795,9 +1791,6 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra ~BIT ((frame_body[3 ] >>4 ) &0xf ); psta->htpriv.candidate_tid_bitmap &= ~BIT ((frame_body[3 ] >>4 ) &0xf ); - -/* reason_code = frame_body[4] | (frame_body[5] << 8); */ - reason_code =get_unaligned_le16 (&frame_body[4 ]); }else if ((frame_body[3 ] &BIT (3 )) ==BIT (3 )) { tid = (frame_body[3 ] >>4 ) &0x0F ;@@ -5127,22 +5120,8 @@ void _linked_info_dump(struct adapter *padapter)if ((pmlmeinfo->state&0x03 ) ==WIFI_FW_STATION_STATE ) {rtw_hal_get_def_var (padapter,HAL_DEF_UNDERCORATEDSMOOTHEDPWDB , &UndecoratedSmoothedPWDB); - }else if ((pmlmeinfo->state&0x03 ) == _HW_STATE_AP_) { -struct list_head *phead, *plist; - -struct sta_info *psta =NULL ; -struct sta_priv *pstapriv = &padapter->stapriv; - -spin_lock_bh (&pstapriv->asoc_list_lock); - phead = &pstapriv->asoc_list; - plist =get_next (phead); -while (phead != plist) { - psta = container_of(plist, struct sta_info, asoc_list); - plist =get_next (plist); - } -spin_unlock_bh (&pstapriv->asoc_list_lock); - } +for (i =0 ; i <NUM_STA ; i++) {if (pdvobj->macid[i]) {
Quoted 8 lines
Quoted 6 lines
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +0
-0if (i !=1 )/* skip bc/mc sta */ Signature · 1 line
2.26.0.106.g9fadeddDoes not apply to my tree :(
Should I split it into three patches?It's like the 2/2 reason.
Quoted 3 lines
.
PATCH 2/2 staging: rtl8723bs: core: eliminate erroneous reporting of unused variable 'evt_seq'
In reply to Zhen LeiGCC reports the following warning with W=1:
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:6003:15: warning:
variable ‘evt_seq’ set but not used [-Wunused-but-set-variable]
6030 | u8 evt_code, evt_seq;
| ^~~~~~~The local variable ‘evt_seq’ is referenced only when the macro CHECK_EVENT_SEQ is defined, move its definition and assignment into the control scope of macro CHECK_EVENT_SEQ, to fix the warning.
By the way, clear local coding style warnings and delete several redundant blank lines.
--- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +11 -11
@@ -5979,7 +5979,7 @@ u8 set_tx_beacon_cmd(struct adapter *padapter)u8 mlme_evt_hdl (struct adapter *padapter,unsigned char *pbuf) { -u8 evt_code, evt_seq; +u8 evt_code;u16 evt_sz;uint *peventbuf;void (*event_callback)(struct adapter *dev,u8 *pbuf);
@@ -5989,19 +5989,23 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf) goto _abort_event_; peventbuf = (uint *)pbuf; - evt_sz = (u16)(*peventbuf&0xffff ); - evt_seq = (u8)((*peventbuf>>24 )&0x7f ); - evt_code = (u8)((*peventbuf>>16 )&0xff ); + evt_sz = (u16)(*peventbuf &0xffff ); + evt_code = (u8)((*peventbuf >>16 ) &0xff ); +#ifdef CHECK_EVENT_SEQ +{ +u8 evt_seq; + + evt_seq = (u8)((*peventbuf >>24 ) &0x7f ); -#ifdef CHECK_EVENT_SEQ /* checking event sequence... */ if (evt_seq != (atomic_read (&pevt_priv->event_seq) &0x7f )) { - pevt_priv->event_seq = (evt_seq+1 )&0x7f ; + pevt_priv->event_seq = (evt_seq +1 ) &0x7f ; goto _abort_event_; } -#endif +} +#endif /* checking if event code is valid */ if (evt_code >=MAX_C2HEVT )
@@ -6023,12 +6027,8 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf) pevt_priv->evt_done_cnt++; } - _abort_event_: - -return H2C_SUCCESS ; - }u8 h2c_msg_hdl (struct adapter *padapter,unsigned char *pbuf)
Signature · 1 line
2.26.0.106.g9fadedd
Greg Kroah-Hartman
maintainerRe: [PATCH 2/2] staging: rtl8723bs: core: eliminate erroneous reporting of unused variable 'evt_seq'
Quoted 7 lines · Zhen Lei
GCC reports the following warning with W=1:
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:6003:15: warning:
variable ‘evt_seq’ set but not used [-Wunused-but-set-variable]6030 | u8 evt_code, evt_seq; | ^~~~~~~
Quoted 6 lines
The local variable ‘evt_seq’ is referenced only when the macro
CHECK_EVENT_SEQis defined, move its definition and assignment into the control scope of macroCHECK_EVENT_SEQ, to fix the warning.By the way, clear local coding style warnings and delete several redundant blank lines.
Do not do lots of different things in the same patch, this should be broken up into doing "one logical thing per change".
Please fix up and send as a series.
thanks,
greg k-h
Re: [PATCH 2/2] staging: rtl8723bs: core: eliminate erroneous reporting of unused variable 'evt_seq'
Quoted 12 lines · Greg Kroah-Hartman
Quoted 11 lines · Zhen Lei
GCC reports the following warning with W=1:
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:6003:15: warning:
variable ‘evt_seq’ set but not used [-Wunused-but-set-variable]6030 | u8 evt_code, evt_seq; | ^~~~~~~The local variable ‘evt_seq’ is referenced only when the macro
CHECK_EVENT_SEQis defined, move its definition and assignment into the control scope of macroCHECK_EVENT_SEQ, to fix the warning.
Quoted 7 lines
Quoted 2 lines
By the way, clear local coding style warnings and delete several redundant blank lines.
Do not do lots of different things in the same patch, this should be broken up into doing "one logical thing per change".
Please fix up and send as a series.
OK, I will split it into two patches.
Quoted 7 lines
thanks,
greg k-h
.