From patchwork Mon Dec 11 17:24:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitry Antipov X-Patchwork-Id: 753479 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=yandex.ru header.i=@yandex.ru header.b="RUSy6P/L" Received: from forward100b.mail.yandex.net (forward100b.mail.yandex.net [178.154.239.147]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4C9A9B for ; Mon, 11 Dec 2023 09:26:26 -0800 (PST) Received: from mail-nwsmtp-smtp-production-main-57.myt.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-57.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:2612:0:640:2e49:0]) by forward100b.mail.yandex.net (Yandex) with ESMTP id 0D7F460A77; Mon, 11 Dec 2023 20:26:22 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-57.myt.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id LQlFup2o5qM0-bT62wD5O; Mon, 11 Dec 2023 20:26:21 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1702315581; bh=CM1w6gTaIaN/j6JhGhj0xEKOVvww+8tWnLwc+W2KNfY=; h=Message-ID:Date:Cc:Subject:To:From; b=RUSy6P/LjEf/0tEUBCwLoDz8wBFqexOaQovZBCbITv83oHXh7v3kVveOimgRgguUl M75XGL/IlNcXy0MD/pSB3h+9/jD25SqAg7JSU0Ug729zke4ovGroYyaA3ie2Ng/sSb GnITnTfhWUzAXvFF++nZ2ldFBxoehIXbFjWCJZoQ= Authentication-Results: mail-nwsmtp-smtp-production-main-57.myt.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen_?= Cc: Kalle Valo , lvc-project@linuxtesting.org, linux-wireless@vger.kernel.org, Dmitry Antipov Subject: [PATCH] wifi: ath9k: fix LNA selection in ath_ant_try_scan() Date: Mon, 11 Dec 2023 20:24:52 +0300 Message-ID: <20231211172502.25202-1-dmantipov@yandex.ru> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 Acked-by: Toke Høiland-Jørgensen --- drivers/net/wireless/ath/ath9k/antenna.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;