summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
diff options
context:
space:
mode:
authorBitterblue Smith <rtl8821cerfe2@gmail.com>2024-01-02 21:33:07 +0200
committerKalle Valo <kvalo@kernel.org>2024-01-10 16:55:37 +0200
commit80850ca041f2c7ee28fa5e47c5c1b106415f099f (patch)
tree2321e9d2b4b74791fb0df779d119072f43ffb53a /drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
parent9475cc7ac31503521af95e38151e9d856e8ff30b (diff)
downloadlinux-80850ca041f2c7ee28fa5e47c5c1b106415f099f.tar.gz
linux-80850ca041f2c7ee28fa5e47c5c1b106415f099f.tar.bz2
linux-80850ca041f2c7ee28fa5e47c5c1b106415f099f.zip
wifi: rtl8xxxu: Fix off by one initial RTS rate
rtl8xxxu_set_basic_rates() sets the wrong initial RTS rate. It sets the next higher rate than the one it should set, e.g. 36M instead of 24M. The while loop was supposed to find the index of the most significant bit which is 1, but it was copied incorrectly from the vendor driver. Use __fls() instead. Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com> Reviewed-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://msgid.link/761e6836-6cd6-4930-91b6-0446834655c5@gmail.com
Diffstat (limited to 'drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c')
-rw-r--r--drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 921d25e152cf..aac594093629 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -4870,10 +4870,9 @@ static void rtl8xxxu_set_basic_rates(struct rtl8xxxu_priv *priv, u32 rate_cfg)
dev_dbg(&priv->udev->dev, "%s: rates %08x\n", __func__, rate_cfg);
- while (rate_cfg) {
- rate_cfg = (rate_cfg >> 1);
- rate_idx++;
- }
+ if (rate_cfg)
+ rate_idx = __fls(rate_cfg);
+
rtl8xxxu_write8(priv, REG_INIRTS_RATE_SEL, rate_idx);
}