cpuidle: teo: Fix intervals[] array indexing bug

Fix a simple bug in rotating array index.

Fixes: b26bf6ab71 ("cpuidle: New timer events oriented governor for tickless systems")
Signed-off-by: Ikjoon Jang <ikjn@chromium.org>
Cc: 5.1+ <stable@vger.kernel.org> # 5.1+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Ikjoon Jang 2020-01-11 01:47:12 +08:00 committed by Rafael J. Wysocki
parent b3a987b026
commit 57388a2ccb

View File

@ -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;
}