Commit 4ffb4d25 authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Johannes Berg

wifi: rtw88: fix uninitialized use of primary channel index

clang reports uninitialized use:

>> drivers/net/wireless/realtek/rtw88/main.c:731:2: warning: variable
   'primary_channel_idx' is used uninitialized whenever switch default is
   taken [-Wsometimes-uninitialized]
           default:
           ^~~~~~~
   drivers/net/wireless/realtek/rtw88/main.c:754:39: note: uninitialized
   use occurs here
           hal->current_primary_channel_index = primary_channel_idx;
                                                ^~~~~~~~~~~~~~~~~~~
   drivers/net/wireless/realtek/rtw88/main.c:687:24: note: initialize the
   variable 'primary_channel_idx' to silence this warning
           u8 primary_channel_idx;
                                 ^
                                  = '\0'

This situation could not happen, because possible channel bandwidth
20/40/80MHz are enumerated.

Fixes: 341dd1f7 ("wifi: rtw88: add the update channel flow to support setting by parameters")
Reported-by: default avatarkernel test robot <lkp@intel.com>
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20220815062004.22920-1-pkshih@realtek.comSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent be50baa4
......@@ -697,6 +697,7 @@ void rtw_update_channel(struct rtw_dev *rtwdev, u8 center_channel,
switch (bandwidth) {
case RTW_CHANNEL_WIDTH_20:
default:
primary_channel_idx = RTW_SC_DONT_CARE;
break;
case RTW_CHANNEL_WIDTH_40:
......@@ -728,8 +729,6 @@ void rtw_update_channel(struct rtw_dev *rtwdev, u8 center_channel,
cch_by_bw[RTW_CHANNEL_WIDTH_40] = center_channel - 4;
}
break;
default:
break;
}
switch (center_channel) {
......
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