All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpuidle: teo: bugfix in intervals[] array indexing
@ 2020-01-10 17:47 Ikjoon Jang
  2020-01-13 10:44 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Ikjoon Jang @ 2020-01-10 17:47 UTC (permalink / raw)
  To: linux-pm, RafaelJ . Wysocki; +Cc: DanielLezcano, linux-kernel, Ikjoon Jang

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 --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;
 }
 
-- 
2.25.0.rc1.283.g88dfdc4193-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cpuidle: teo: bugfix in intervals[] array indexing
  2020-01-10 17:47 [PATCH] cpuidle: teo: bugfix in intervals[] array indexing Ikjoon Jang
@ 2020-01-13 10:44 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2020-01-13 10:44 UTC (permalink / raw)
  To: Ikjoon Jang
  Cc: Linux PM, RafaelJ . Wysocki, DanielLezcano, Linux Kernel Mailing List

On Fri, Jan 10, 2020 at 6:47 PM Ikjoon Jang <ikjn@chromium.org> wrote:
>
> 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 --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;
>  }
>
> --

Applied as a fix for 5,5 and "stable", thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-13 10:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-10 17:47 [PATCH] cpuidle: teo: bugfix in intervals[] array indexing Ikjoon Jang
2020-01-13 10:44 ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.