diff mbox series

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

Message ID 20240216033949.34765-1-pkshih@realtek.com (mailing list archive)
State Accepted
Commit 9208e85c62720608aa6ec6e4265b584a48fb43b0
Delegated to: Kalle Valo
Headers show
Series wifi: rtlwifi: set initial values for unexpected cases of USB endpoint priority | expand

Commit Message

Ping-Ke Shih Feb. 16, 2024, 3:39 a.m. UTC
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 <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Kalle Valo Feb. 21, 2024, 6:55 p.m. UTC | #1
Ping-Ke Shih <pkshih@realtek.com> 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 <pkshih@realtek.com>

Patch applied to wireless-next.git, thanks.

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

Patch

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;