]> git.baikalelectronics.ru Git - kernel.git/commitdiff
cpuidle: teo: Fix intervals[] array indexing bug
authorIkjoon Jang <ikjn@chromium.org>
Fri, 10 Jan 2020 17:47:12 +0000 (01:47 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 13 Jan 2020 10:14:58 +0000 (11:14 +0100)
Fix a simple bug in rotating array index.

Fixes: bc412a26fc66 ("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>
drivers/cpuidle/governors/teo.c

index de7e706efd460e86dea44c7b21fc5d078d6bf8f4..6deaaf5f05b5765598115132492edc4f654df9da 100644 (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;
 }