]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: rtw89: 8852c: rfk: refine target channel calculation in _rx_dck_channel_calc()
authorPing-Ke Shih <pkshih@realtek.com>
Mon, 9 Dec 2024 04:20:19 +0000 (12:20 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Thu, 12 Dec 2024 03:06:19 +0000 (11:06 +0800)
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>
Link: https://patch.msgid.link/20241209042020.21290-1-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c

index bd17c0a1c6846b1774b9accacf387667a52beabc..b92e2ce4f4adca19901bff10376e13bcaad769ac 100644 (file)
@@ -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;
        }