2024-02-16 03:40:40

by Ping-Ke Shih

[permalink] [raw]
Subject: [PATCH] wifi: rtlwifi: set initial values for unexpected cases of USB endpoint priority

Map USB endpoints to hardware and AC queues according to number of USB
endpoints. However, original only give a warning for unexpected cases but
initial values are not given. Then, smatch warns:

drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c:642
_rtl92cu_init_chipn_two_out_ep_priority() error: uninitialized symbol 'valuelow'.
drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c:644
_rtl92cu_init_chipn_two_out_ep_priority() error: uninitialized symbol 'valuehi'.
drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c:649
_rtl92cu_init_chipn_two_out_ep_priority() error: uninitialized symbol 'valuehi'.
drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c:650
_rtl92cu_init_chipn_two_out_ep_priority() error: uninitialized symbol 'valuelow'.

The regular selection is high and low queues, so move default (unexpected)
case along with that.

Compile tested only.

Signed-off-by: Ping-Ke Shih <[email protected]>
---
drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c
index 5ec0eb8773a5..4217c9a08d01 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c
@@ -622,6 +622,9 @@ static void _rtl92cu_init_chipn_two_out_ep_priority(struct ieee80211_hw *hw,
u16 valuelow;

switch (queue_sel) {
+ default:
+ WARN_ON(1);
+ fallthrough;
case (TX_SELE_HQ | TX_SELE_LQ):
valuehi = QUEUE_HIGH;
valuelow = QUEUE_LOW;
@@ -634,9 +637,6 @@ static void _rtl92cu_init_chipn_two_out_ep_priority(struct ieee80211_hw *hw,
valuehi = QUEUE_HIGH;
valuelow = QUEUE_NORMAL;
break;
- default:
- WARN_ON(1);
- break;
}
if (!wmm_enable) {
beq = valuelow;
--
2.25.1



2024-02-21 18:56:36

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH] wifi: rtlwifi: set initial values for unexpected cases of USB endpoint priority

Ping-Ke Shih <[email protected]> wrote:

> Map USB endpoints to hardware and AC queues according to number of USB
> endpoints. However, original only give a warning for unexpected cases but
> initial values are not given. Then, smatch warns:
>
> drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c:642
> _rtl92cu_init_chipn_two_out_ep_priority() error: uninitialized symbol 'valuelow'.
> drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c:644
> _rtl92cu_init_chipn_two_out_ep_priority() error: uninitialized symbol 'valuehi'.
> drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c:649
> _rtl92cu_init_chipn_two_out_ep_priority() error: uninitialized symbol 'valuehi'.
> drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c:650
> _rtl92cu_init_chipn_two_out_ep_priority() error: uninitialized symbol 'valuelow'.
>
> The regular selection is high and low queues, so move default (unexpected)
> case along with that.
>
> Compile tested only.
>
> Signed-off-by: Ping-Ke Shih <[email protected]>

Patch applied to wireless-next.git, thanks.

9208e85c6272 wifi: rtlwifi: set initial values for unexpected cases of USB endpoint priority

--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches