linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>, linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-staging@lists.linux.dev
Subject: Re: [PATCH] staging: rtl8723bs: core: rtw_mlme_ext.c: Remove set but unused variable
Date: Mon, 24 May 2021 13:15:03 +0200	[thread overview]
Message-ID: <2101445.5PPBstrGkB@linux.local> (raw)
In-Reply-To: <20210524092552.GO1955@kadam>

On Monday, May 24, 2021 11:25:52 AM CEST Dan Carpenter wrote:
> On Sun, May 23, 2021 at 07:30:42PM +0200, Fabio M. De Francesco wrote:
> > 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.
> > 
> > Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> > ---
> > 
> >  drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> > b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c index 
9fc612fb736f..a13b3ec42bc9
> > 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> > @@ -1721,7 +1721,7 @@ unsigned int OnAction_back(struct adapter *padapter, 
union
> > recv_frame *precv_fra> 
> >  	struct 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]);
> 
> 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
>
> regards,
> dan carpenter





      reply	other threads:[~2021-05-24 11:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-23 17:30 [PATCH] staging: rtl8723bs: core: rtw_mlme_ext.c: Remove set but unused variable Fabio M. De Francesco
2021-05-24  9:25 ` Dan Carpenter
2021-05-24 11:15   ` Fabio M. De Francesco [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2101445.5PPBstrGkB@linux.local \
    --to=fmdefrancesco@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).