diff mbox series

wifi: ath9k: fix LNA selection in ath_ant_try_scan()

Message ID 20231211172502.25202-1-dmantipov@yandex.ru (mailing list archive)
State Accepted
Commit d6b27eb997ef9a2aa51633b3111bc4a04748e6d3
Delegated to: Kalle Valo
Headers show
Series wifi: ath9k: fix LNA selection in ath_ant_try_scan() | expand

Commit Message

Dmitry Antipov Dec. 11, 2023, 5:24 p.m. UTC
In 'ath_ant_try_scan()', (most likely) the 2nd LNA's signal
strength should be used in comparison against RSSI when
selecting first LNA as the main one. Compile tested only.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
 drivers/net/wireless/ath/ath9k/antenna.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Toke Høiland-Jørgensen Dec. 15, 2023, 11:24 a.m. UTC | #1
Dmitry Antipov <dmantipov@yandex.ru> writes:

> In 'ath_ant_try_scan()', (most likely) the 2nd LNA's signal
> strength should be used in comparison against RSSI when
> selecting first LNA as the main one. Compile tested only.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>

Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Kalle Valo Dec. 18, 2023, 6:46 p.m. UTC | #2
Dmitry Antipov <dmantipov@yandex.ru> wrote:

> In 'ath_ant_try_scan()', (most likely) the 2nd LNA's signal
> strength should be used in comparison against RSSI when
> selecting first LNA as the main one. Compile tested only.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
> Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

Patch applied to ath-next branch of ath.git, thanks.

d6b27eb997ef wifi: ath9k: fix LNA selection in ath_ant_try_scan()
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath9k/antenna.c b/drivers/net/wireless/ath/ath9k/antenna.c
index 988222cea9df..acc84e6711b0 100644
--- a/drivers/net/wireless/ath/ath9k/antenna.c
+++ b/drivers/net/wireless/ath/ath9k/antenna.c
@@ -643,7 +643,7 @@  static void ath_ant_try_scan(struct ath_ant_comb *antcomb,
 				conf->main_lna_conf = ATH_ANT_DIV_COMB_LNA1;
 				conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2;
 			} else if (antcomb->rssi_sub >
-				   antcomb->rssi_lna1) {
+				   antcomb->rssi_lna2) {
 				/* set to A-B */
 				conf->main_lna_conf = ATH_ANT_DIV_COMB_LNA1;
 				conf->alt_lna_conf = ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2;