diff mbox series

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

Message ID 20241209042020.21290-1-pkshih@realtek.com (mailing list archive)
State Accepted
Delegated to: Ping-Ke Shih
Headers show
Series [1/2] wifi: rtw89: 8852c: rfk: refine target channel calculation in _rx_dck_channel_calc() | expand

Commit Message

Ping-Ke Shih Dec. 9, 2024, 4:20 a.m. UTC
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")

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Ping-Ke Shih Dec. 12, 2024, 3:08 a.m. UTC | #1
Ping-Ke Shih <pkshih@realtek.com> wrote:

> 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")
> 
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>

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
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
index bd17c0a1c684..b92e2ce4f4ad 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
@@ -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;
 	}