diff mbox series

mt76: fix invalid rssi report

Message ID 6143aa93f2b705ec84f9a0eef2d2cd61436a9b6f.1646929388.git.deren.wu@mediatek.com (mailing list archive)
State Accepted
Delegated to: Felix Fietkau
Headers show
Series mt76: fix invalid rssi report | expand

Commit Message

Deren Wu March 10, 2022, 4:42 p.m. UTC
From: Deren Wu <deren.wu@mediatek.com>

Drop invalid rssi value to calculate a reasonable report

Fixes: 4550fb9e9810 ("mt76: improve signal strength reporting")
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/mac80211.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c
index 372b94a665ec..5b53d008eb66 100644
--- a/drivers/net/wireless/mediatek/mt76/mac80211.c
+++ b/drivers/net/wireless/mediatek/mt76/mac80211.c
@@ -942,10 +942,11 @@  mt76_rx_signal(struct mt76_rx_status *status)
 	for (chains = status->chains; chains; chains >>= 1, chain_signal++) {
 		int cur, diff;
 
-		if (!(chains & BIT(0)))
+		cur = *chain_signal;
+		if (!(chains & BIT(0)) ||
+		    cur > 0)
 			continue;
 
-		cur = *chain_signal;
 		if (cur > signal)
 			swap(cur, signal);