wifi: rtw89: coex: Add Bluetooth binding for Bluetooth RX gain setting
Hello Ching-Te Ku,
Commit fe8f6ddb9095 ("wifi: rtw89: coex: Add Bluetooth binding for Bluetooth RX gain setting") from Jul 6, 2026 (linux-next), leads to the following Smatch static checker warning:
drivers/net/wireless/realtek/rtw89/coex.c:3943 _set_bt_rx_gain() warn: duplicate check 'rf_band' (previous on line 3927)
drivers/net/wireless/realtek/rtw89/coex.c
3914 static void _set_bt_rx_gain(struct rtw89_dev *rtwdev, bool force_exec, u8 bid,
3915 u8 rf_band, u8 level)
3916 {
3917 struct rtw89_btc *btc = &rtwdev->btc;
3918 struct rtw89_btc_cx *cx = &btc->cx;
3919 struct rtw89_btc_bt_info *bt = &cx->bt0;
3920 u8 h2c_func = SET_BT_LNA_CONSTRAIN;
3921 u8 i, id_start, id_stop;
3922 bool state = false;
3923 u32 scbd_bit = 0;
3924 u8 buf[2] = {};
3925 u8 len = sizeof(*buf);
3926
3927 if (bt->bcnt[BTC_BCNT_INFOUPDATE] == 0 || !rf_band)
^^^^^^^The patch adds a check here
3928 return;
3929
3930 if (bt->rf_para.rx_gain_freerun == level ||
3931 level > BTC_BT_RX_NORMAL_LVL || !rtwdev->chip->scbd ||
3932 bid > BTC_ALL_BT)
3933 return;
3934
3935 if (bid == BTC_ALL_BT) {
3936 id_start = BTC_BT_1ST;
3937 id_stop = BTC_BT_2ND;
3938 } else {
3939 id_start = bid;
3940 id_stop = bid;
3941 }
3942
--> 3943 if (rf_band == RTW89_BAND_2G)
^^^^^^^^^^^^^^^^^^^^^^^^RTW89_BAND_2G is zero so this is dead code.
3944 scbd_bit |= BTC_WSCB_RXGAIN;
3945 else
3946 scbd_bit |= BTC_WSCB_RXGAIN_56G;
3947 This email is a free service from the Smatch-CI project [smatch.sf.net].
regards,
dan carpenter
Quoted 25 lines · Dan Carpenter
Hello Ching-Te Ku,
Commit
fe8f6ddb9095("wifi: rtw89: coex: Add Bluetooth binding for Bluetooth RX gain setting") from Jul 6, 2026 (linux-next), leads to the following Smatch static checker warning:
drivers/net/wireless/realtek/rtw89/coex.c:3943_set_bt_rx_gain()
warn: duplicate check 'rf_band' (previous on line 3927)
drivers/net/wireless/realtek/rtw89/coex.c3914 static void _set_bt_rx_gain(struct rtw89_dev *rtwdev, bool force_exec, u8 bid, 3915 u8 rf_band, u8 level) 3916 { 3917 struct rtw89_btc *btc = &rtwdev->btc; 3918 struct rtw89_btc_cx *cx = &btc->cx; 3919 struct rtw89_btc_bt_info *bt = &cx->bt0; 3920 u8 h2c_func = SET_BT_LNA_CONSTRAIN; 3921 u8 i, id_start, id_stop; 3922 bool state = false; 3923 u32 scbd_bit = 0; 3924 u8 buf[2] = {}; 3925 u8 len = sizeof(*buf); 3926 3927 if (bt->bcnt[BTC_BCNT_INFOUPDATE] == 0 || !rf_band) ^^^^^^^
Quoted 1 line
The patch adds a check here
Thanks for the report. We will remove the rf_band checking here.
Ping-Ke