Skip to contentSkip to conversation

wifi: rtw89: 8852c: rfk: refine target channel calculation in _rx_dck_channel_calc()

PATCH In review Ping-Ke Shih 1 participant 3 messages Dec 9, 2024 – Dec 12, 2024 Realtek wireless driver (rtw89)

lore
Share & tools
lore

Ping-Ke Shih

author maintainer
#0 lore raw

PATCH 1/2 wifi: rtw89: 8852c: rfk: refine target channel calculation in _rx_dck_channel_calc()

The channel is not possibly 0, so original code is fine. Still want to avoid Coverity warning, so ensure -32 offset for the channel number which is larger than 125 only. Actually, don't change logic at all.

Addresses-Coverity-ID: 1628150 ("Overflowed constant")

---
 drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c +3 -3
index bd17c0a1c684..b92e2ce4f4ad 100644
@@ -1769,10 +1769,10 @@ u8 _rx_dck_channel_calc(struct rtw89_dev *rtwdev, const struct rtw89_chan *chan)
 			target_ch = chan->channel - 33;
 		}
 	} else if (chan->band_type == RTW89_BAND_6G) {
-		if (chan->channel >= 1 && chan->channel <= 125)
-			target_ch = chan->channel + 32;
-		else
+		if (chan->channel > 125)
 			target_ch = chan->channel - 32;
+		else
+			target_ch = chan->channel + 32;
 	} else {
 		target_ch = chan->channel;
 	}
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH 2/2 wifi: rtw89: 8851b: rfk: remove unnecessary assignment of return value of _dpk_dgain_read()

The return value of _dpk_dgain_read() is not used afterward, so remove it safely.

Addresses-Coverity-ID: 1504753 ("Unused value")

---
 drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c +1 -1
index 364e36354225..f72b3ac6f149 100644
@@ -2199,7 +2199,7 @@ static u8 _dpk_agc(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
 
 			if (dgain > 0x5fc || dgain < 0x556) {
 				_dpk_one_shot(rtwdev, phy, path, D_SYNC);
-				dgain = _dpk_dgain_read(rtwdev);
+				_dpk_dgain_read(rtwdev);
 			}
 
 			if (agc_cnt == 0) {
Signature · 1 line
2.25.1
author maintainer
#2 lore raw
In reply to Ping-Ke Shih
Quoted 7 lines · Ping-Ke Shih

The channel is not possibly 0, so original code is fine. Still want to avoid Coverity warning, so ensure -32 offset for the channel number which is larger than 125 only. Actually, don't change logic at all.

Addresses-Coverity-ID: 1628150 ("Overflowed constant")

2 patch(es) applied to rtw-next branch of rtw.git, thanks.

b6c10a193637 wifi: rtw89: 8852c: rfk: refine target channel calculation in _rx_dck_channel_calc() 5fdf5e557f06 wifi: rtw89: 8851b: rfk: remove unnecessary assignment of return value of _dpk_dgain_read()

---
https://github.com/pkshih/rtw.git