wifi: rtl8xxxu: Fix assignment to bit field priv->pi_enabled
PATCH 1/2 wifi: rtl8xxxu: Fix assignment to bit field priv->pi_enabled
Just because priv->pi_enabled is only one bit doesn't mean it works like a bool. The value assigned to it loses all bits except bit 0, so only assign 0 or 1 to it.
This affects the RTL8188FU, but fixing the assignment didn't make a difference for my device.
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c +1 -1
@@ -1122,7 +1122,7 @@ static void rtl8188fu_phy_iqcalibrate(struct rtl8xxxu_priv *priv,if (t ==0 ) { val32 =rtl8xxxu_read32 (priv,REG_FPGA0_XA_HSSI_PARM1 ); - priv->pi_enabled = val32 &FPGA0_HSSI_PARM1_PI ; + priv->pi_enabled =u32_get_bits (val32,FPGA0_HSSI_PARM1_PI ); }/* save RF path */
Signature · 1 line
2.38.0
PATCH 2/2 wifi: rtl8xxxu: Fix assignment to bit field priv->cck_agc_report_type
Just because priv->cck_agc_report_type is only one bit doesn't mean it works like a bool. The value assigned to it loses all bits except bit 0, so only assign 0 or 1 to it.
This affects the RTL8192EU, but rtl8xxxu already can't connect to any networks with this chip, so it probably didn't bother anyone.
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +4 -2
@@ -4208,10 +4208,12 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)* should be equal or CCK RSSI report may be incorrect */ val32 =rtl8xxxu_read32 (priv,REG_FPGA0_XA_HSSI_PARM2 ); - priv->cck_agc_report_type = val32 &FPGA0_HSSI_PARM2_CCK_HIGH_PWR ; + priv->cck_agc_report_type = +u32_get_bits (val32,FPGA0_HSSI_PARM2_CCK_HIGH_PWR ); val32 =rtl8xxxu_read32 (priv,REG_FPGA0_XB_HSSI_PARM2 ); -if (priv->cck_agc_report_type != (bool )(val32 &FPGA0_HSSI_PARM2_CCK_HIGH_PWR )) { +if (priv->cck_agc_report_type != +u32_get_bits (val32,FPGA0_HSSI_PARM2_CCK_HIGH_PWR )) {if (priv->cck_agc_report_type) val32 |=FPGA0_HSSI_PARM2_CCK_HIGH_PWR ;else
Signature · 1 line
2.38.0
Quoted 9 lines
-----Original Message-----
From: Bitterblue Smith <[email protected]>
Sent: Friday, December 9, 2022 3:32 AM
To: [email protected]
Cc: Jes Sorensen <[email protected]>; Ping-Ke Shih <[email protected]>
Subject: [PATCH 1/2] wifi: rtl8xxxu: Fix assignment to bit fieldpriv->pi_enabled
Quoted 6 lines
Just because
priv->pi_enabledis only one bit doesn't mean it works like a bool. The value assigned to it loses all bits except bit 0, so only assign 0 or 1 to it.This affects the RTL8188FU, but fixing the assignment didn't make a difference for my device.
The reason is the bit is always 0, I have similar review days ago [1].
[1] https://lore.kernel.org/linux-wireless/[email protected]/
Quoted 3 lines
Fixes c888183b21f3 ("wifi: rtl8xxxu: Support new chip RTL8188FU")Signed-off-by Bitterblue Smith <[email protected]>
Quoted 22 lines
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c +1
-2@@ -1122,7 +1122,7 @@ static void rtl8188fu_phy_iqcalibrate(struct rtl8xxxu_priv *priv,if (t ==0 ) { val32 =rtl8xxxu_read32 (priv,REG_FPGA0_XA_HSSI_PARM1 ); - priv->pi_enabled = val32 &FPGA0_HSSI_PARM1_PI ; + priv->pi_enabled =u32_get_bits (val32,FPGA0_HSSI_PARM1_PI ); }/* save RF path */ --2.38.0
------Please consider the environment before printing this e-mail.
RE: [PATCH 2/2] wifi: rtl8xxxu: Fix assignment to bit field priv->cck_agc_report_type
In reply to Bitterblue SmithQuoted 13 lines
-----Original Message-----
From: Bitterblue Smith <[email protected]>
Sent: Friday, December 9, 2022 3:34 AM
To: [email protected]
Cc: Jes Sorensen <[email protected]>; Ping-Ke Shih <[email protected]>
Subject: [PATCH 2/2] wifi: rtl8xxxu: Fix assignment to bit fieldpriv->cck_agc_report_typeJust because
priv->cck_agc_report_typeis only one bit doesn't mean it works like a bool. The value assigned to it loses all bits except bit 0, so only assign 0 or 1 to it.
Quoted 5 lines
This affects the RTL8192EU, but rtl8xxxu already can't connect to any networks with this chip, so it probably didn't bother anyone.
Fixes 2ad2a813b803 ("wifi: rtl8xxxu: Fix the CCK RSSI calculation")Signed-off-by Bitterblue Smith <[email protected]>
Quoted 28 lines
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +4
-3@@ -4208,10 +4208,12 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)* should be equal or CCK RSSI report may be incorrect */ val32 =rtl8xxxu_read32 (priv,REG_FPGA0_XA_HSSI_PARM2 ); - priv->cck_agc_report_type = val32 &FPGA0_HSSI_PARM2_CCK_HIGH_PWR ; + priv->cck_agc_report_type = +u32_get_bits (val32,FPGA0_HSSI_PARM2_CCK_HIGH_PWR ); val32 =rtl8xxxu_read32 (priv,REG_FPGA0_XB_HSSI_PARM2 ); -if (priv->cck_agc_report_type != (bool )(val32 &FPGA0_HSSI_PARM2_CCK_HIGH_PWR )) { +if (priv->cck_agc_report_type != +u32_get_bits (val32,FPGA0_HSSI_PARM2_CCK_HIGH_PWR )) {if (priv->cck_agc_report_type) val32 |=FPGA0_HSSI_PARM2_CCK_HIGH_PWR ;else --2.38.0
------Please consider the environment before printing this e-mail.
Quoted 10 lines · Bitterblue Smith
Just because
priv->pi_enabledis only one bit doesn't mean it works like a bool. The value assigned to it loses all bits except bit 0, so only assign 0 or 1 to it.This affects the RTL8188FU, but fixing the assignment didn't make a difference for my device.
Fixes c888183b21f3 ("wifi: rtl8xxxu: Support new chip RTL8188FU")Signed-off-by Bitterblue Smith <[email protected]>Reviewed-by Ping-Ke Shih <[email protected]>
2 patches applied to wireless-next.git, thanks.
9e32b4a709f0 wifi: rtl8xxxu: Fix assignment to bit field priv->pi_enabled 639c26faf9b1 wifi: rtl8xxxu: Fix assignment to bit field priv->cck_agc_report_type
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches