From: Zhen Lei <thunder.leizhen@huawei.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Fabio Aiuto <fabioaiuto83@gmail.com>,
Hans de Goede <hdegoede@redhat.com>,
linux-staging <linux-staging@lists.linux.dev>
Cc: Zhen Lei <thunder.leizhen@huawei.com>
Subject: [PATCH 2/2] staging: rtl8723bs: core: eliminate erroneous reporting of unused variable 'evt_seq'
Date: Thu, 13 May 2021 17:40:07 +0800 [thread overview]
Message-ID: <20210513094007.6435-3-thunder.leizhen@huawei.com> (raw)
In-Reply-To: <20210513094007.6435-1-thunder.leizhen@huawei.com>
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_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.
Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 22 +++++++++----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index acf5578863e17d7..8b7194ccacac0ee 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -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)
--
2.26.0.106.g9fadedd
next prev parent reply other threads:[~2021-05-13 9:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-13 9:40 [PATCH 0/2] Clear several unused local variable warnings Zhen Lei
2021-05-13 9:40 ` [PATCH 1/2] staging: rtl8723bs: core: remove three unused local variables Zhen Lei
2021-05-13 18:14 ` Greg Kroah-Hartman
2021-05-14 1:04 ` Leizhen (ThunderTown)
2021-05-13 9:40 ` Zhen Lei [this message]
2021-05-13 18:13 ` [PATCH 2/2] staging: rtl8723bs: core: eliminate erroneous reporting of unused variable 'evt_seq' Greg Kroah-Hartman
2021-05-14 1:02 ` Leizhen (ThunderTown)
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=20210513094007.6435-3-thunder.leizhen@huawei.com \
--to=thunder.leizhen@huawei.com \
--cc=fabioaiuto83@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hdegoede@redhat.com \
--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