Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1700311

[PATCH] clocksource: arm_arch_timer: Fix mem frame loop initialization

From Matthias Kaehlcke <mka@chromium.org>
Newsgroups linux.kernel
Subject [PATCH] clocksource: arm_arch_timer: Fix mem frame loop initialization
Date 2017-07-31 20:40 +0200
Message-ID <u9nLI-1gu-11@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


The loop to find the best memory frame in arch_timer_mem_acpi_init()
initializes the loop counter with itself ('i = i'), which is suspicious
in the first place and pointed out by clang. The loop condition is
'i < timer_count' and a prior for loop exits when 'i' reaches
'timer_count', therefore the second loop is never executed.

Initialize the loop counter with 0 to iterate over all timers, which
supposedly was the intention before the typo monster attacked.

Fixes: c2743a36765d3 ("clocksource: arm_arch_timer: add GTDT support for memory-mapped timer")
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---
 drivers/clocksource/arm_arch_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index aae87c4c546e..72bbfccef113 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -1440,7 +1440,7 @@ static int __init arch_timer_mem_acpi_init(int platform_timer_count)
 	 * While unlikely, it's theoretically possible that none of the frames
 	 * in a timer expose the combination of feature we want.
 	 */
-	for (i = i; i < timer_count; i++) {
+	for (i = 0; i < timer_count; i++) {
 		timer = &timers[i];
 
 		frame = arch_timer_mem_find_best_frame(timer);
-- 
2.14.0.rc0.400.g1c36432dff-goog

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] clocksource: arm_arch_timer: Fix mem frame loop initialization Matthias Kaehlcke <mka@chromium.org> - 2017-07-31 20:40 +0200
  Re: [PATCH] clocksource: arm_arch_timer: Fix mem frame loop  initialization Mark Rutland <mark.rutland@arm.com> - 2017-08-01 13:20 +0200
    Re: [PATCH] clocksource: arm_arch_timer: Fix mem frame loop  initialization Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-08-01 13:40 +0200

csiph-web