Commit 398eb194 authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo

wifi: rtl8xxxu: 8188e: parse single one element of RA report for station mode

Intentionally parsing single one element of RA report by breaking loop
causes a smatch warning:
  drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c:1678 rtl8188e_handle_ra_tx_report2() warn:
  ignoring unreachable code.

With existing comments, it intends to process single one element for
station mode, but it will parse more elements in AP mode if it's
implemented. Implement program logic according to existing comment to avoid
smatch warning, and also be usable for both AP and stations modes.

Compile test only.
Reported-by: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarDan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/r/202302142135.LCqUTVGY-lkp@intel.com/
Cc: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Tested-by: default avatarBitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230216004654.4642-1-pkshih@realtek.com
parent 015bf4df
...@@ -1699,6 +1699,12 @@ void rtl8188e_handle_ra_tx_report2(struct rtl8xxxu_priv *priv, struct sk_buff *s ...@@ -1699,6 +1699,12 @@ void rtl8188e_handle_ra_tx_report2(struct rtl8xxxu_priv *priv, struct sk_buff *s
dev_dbg(dev, "%s: len: %d items: %d\n", __func__, tx_rpt_len, items); dev_dbg(dev, "%s: len: %d items: %d\n", __func__, tx_rpt_len, items);
/* We only use macid 0, so only the first item is relevant.
* AP mode will use more of them if it's ever implemented.
*/
if (!priv->vif || priv->vif->type == NL80211_IFTYPE_STATION)
items = 1;
for (macid = 0; macid < items; macid++) { for (macid = 0; macid < items; macid++) {
valid = false; valid = false;
...@@ -1741,12 +1747,6 @@ void rtl8188e_handle_ra_tx_report2(struct rtl8xxxu_priv *priv, struct sk_buff *s ...@@ -1741,12 +1747,6 @@ void rtl8188e_handle_ra_tx_report2(struct rtl8xxxu_priv *priv, struct sk_buff *s
min_rpt_time = ra->rpt_time; min_rpt_time = ra->rpt_time;
rpt += TX_RPT2_ITEM_SIZE; rpt += TX_RPT2_ITEM_SIZE;
/*
* We only use macid 0, so only the first item is relevant.
* AP mode will use more of them if it's ever implemented.
*/
break;
} }
if (min_rpt_time != ra->pre_min_rpt_time) { if (min_rpt_time != ra->pre_min_rpt_time) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment