wlan: Fix incorrect updation of RSSI value
Currently the stale_index is crossing the max value
of WLANTL_RSSI_SAMPLE_CNT and resulting in incorrect
updation of rssi_sample_sum.
Fix conditional logic such that stale_index does
not cross the max value.
Change-Id: I31f7206ab814d20161bcd68041cc1c06c5d1d8b8
CRs-Fixed: 2240051
diff --git a/CORE/TL/src/wlan_qct_tl.c b/CORE/TL/src/wlan_qct_tl.c
index 4668f62..c5281fd 100644
--- a/CORE/TL/src/wlan_qct_tl.c
+++ b/CORE/TL/src/wlan_qct_tl.c
@@ -6164,7 +6164,7 @@
pClientSTA->rssi_sample_sum -= pClientSTA->rssi_sample[old_idx];
pClientSTA->rssi_sample[old_idx] = curr_RSSI;
pClientSTA->rssi_sample_sum += pClientSTA->rssi_sample[old_idx];
- old_idx >= WLANTL_RSSI_SAMPLE_CNT ? old_idx = 0 : old_idx++;
+ old_idx >= (WLANTL_RSSI_SAMPLE_CNT - 1) ? old_idx = 0 : old_idx++;
pClientSTA->rssi_stale_idx = old_idx;
} else {
pClientSTA->rssi_sample[count] = curr_RSSI;