staging: rtl8723bs: core: rtw_mlme_ext.c: Remove set but unused variable
PATCH 1/1 staging: rtl8723bs: core: rtw_mlme_ext.c: Remove set but unused variable
Removed set but unused 'reason_code' variable. Issue detected by GCC running with the warning option -Wunused-but-set-variable. Removed its use as a storage of the return value of get_unaligned_le16(), which has been left as is because it has side effects on the argument it takes.
--- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +2 -3
@@ -1721,7 +1721,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;
@@ -1791,8 +1791,7 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra 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 ]); +get_unaligned_le16 (&frame_body[4 ]); }else if ((frame_body[3 ] &BIT (3 )) ==BIT (3 )) { tid = (frame_body[3 ] >>4 ) &0x0F ;
Signature · 1 line
2.31.1
Quoted 24 lines · Fabio M. De Francesco
Removed set but unused '
reason_code' variable. Issue detected by GCC running with the warning option -Wunused-but-set-variable. Removed its use as a storage of the return value ofget_unaligned_le16(), which has been left as is because it has side effects on the argument it takes.Signed-off-by Fabio M. De Francesco <[email protected]>--- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +1
-1@@ -1721,7 +1721,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;
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra · line 1794
Quoted 6 lines
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +1
-2@@ -1791,8 +1791,7 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra 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 ]); +get_unaligned_le16 (&frame_body[4 ]);
It doesn't have any side effects. Just delete it too.
regards,
dan carpenter
Quoted 6 lines · CEST Dan Carpenter
Quoted 5 lines · Fabio M. De Francesco
Removed set but unused '
reason_code' variable. Issue detected by GCC running with the warning option -Wunused-but-set-variable. Removed its use as a storage of the return value ofget_unaligned_le16(), which has been left as is because it has side effects on the argument it takes.
Quoted 8 lines
Quoted 8 lines
Signed-off-by Fabio M. De Francesco <[email protected]>---
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.cindex
9fc612fb736f..a13b3ec42bc9
Quoted 4 lines
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c unsigned int OnAction_back(struct adapter *padapter,
Quoted 4 lines
100644
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +0
-0@@ -1721,7 +1721,7 @@ unsigned int OnAction_back(struct adapter *padapter,
union
Quoted 5 lines
Quoted 5 lines
recv_frame*precv_fra>drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +0
-0struct recv_reorder_ctrl *preorder_ctrl;unsigned char *frame_body;unsigned char category, action;
Quoted 8 lines
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c unsigned int OnAction_back(struct adapter *padapter,
Quoted 8 lines
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +1
-1-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;@@ -1791,8 +1791,7 @@ unsigned int OnAction_back(struct adapter *padapter,
union
Quoted 2 lines
Quoted 2 lines
recv_frame*precv_fra>
psta->htpriv.candidate_tid_bitmap
&=
Quoted 2 lines
Quoted 2 lines
~BIT((frame_body[3] >>
4) & 0xf);
Quoted 2 lines
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
Quoted 2 lines
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +0
-1-/* reason_code = frame_body[4] |
(frame_body[5] << 8); */
Quoted 1 line
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
Quoted 1 line
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +0
-1- reason_code =
get_unaligned_le16(&frame_body[4]);
Quoted 1 line
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
Quoted 1 line
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +1
-0+
get_unaligned_le16(&frame_body[4]);
Quoted 3 lines
It doesn't have any side effects. Just delete it too.
It seems that I misinterpreted the semantics of get_unaligned_le16(). If I'm not still wrong the above function uses the __swab16 macro, which returns swapped bytes with _no_ side effects on the swapped variable.
I'm about to send a patch v2 with the deletion suggested by you.
Thanks,
Fabio
Quoted 3 lines
regards,
dan carpenter