diff mbox series

cpuidle: teo: bugfix in intervals[] array indexing

Message ID 20200110174712.7019-1-ikjn@chromium.org
State New
Headers show
Series cpuidle: teo: bugfix in intervals[] array indexing | expand

Commit Message

Ikjoon Jang Jan. 10, 2020, 5:47 p.m. UTC
Fix a simple bug in rotating array index.

Signed-off-by: Ikjoon Jang <ikjn@chromium.org>
---
 drivers/cpuidle/governors/teo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/cpuidle/governors/teo.c b/drivers/cpuidle/governors/teo.c
index de7e706efd46..6deaaf5f05b5 100644
--- a/drivers/cpuidle/governors/teo.c
+++ b/drivers/cpuidle/governors/teo.c
@@ -198,7 +198,7 @@  static void teo_update(struct cpuidle_driver *drv, struct cpuidle_device *dev)
 	 * pattern detection.
 	 */
 	cpu_data->intervals[cpu_data->interval_idx++] = measured_ns;
-	if (cpu_data->interval_idx > INTERVALS)
+	if (cpu_data->interval_idx >= INTERVALS)
 		cpu_data->interval_idx = 0;
 }