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


Groups > linux.kernel > #1709658

[PATCH 1/5] clocksource/drivers/arm_arch_timer: Fix mem frame loop initialization

From Daniel Lezcano <daniel.lezcano@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 1/5] clocksource/drivers/arm_arch_timer: Fix mem frame loop initialization
Date 2017-08-11 16:20 +0200
Message-ID <udiX7-4AP-9@gated-at.bofh.it> (permalink)
References <udiX7-4AP-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Matthias Kaehlcke <mka@chromium.org>

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>
Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.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 aae87c4..72bbfcc 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.7.4

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


Thread

(none) Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-08-11 16:20 +0200
  Re: [GIT PULL] clockevents: fixes for 4.13-rc4 Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-08-11 16:20 +0200
    Re: [GIT PULL] clockevents: fixes for 4.13-rc4 Linus Torvalds <torvalds@linux-foundation.org> - 2017-08-11 20:50 +0200
      Re: [GIT PULL] clockevents: fixes for 4.13-rc4 Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-08-11 23:50 +0200
        Re: [GIT PULL] clockevents: fixes for 4.13-rc4 Linus Torvalds <torvalds@linux-foundation.org> - 2017-08-12 01:00 +0200
        Re: [GIT PULL] clockevents: fixes for 4.13-rc4 Ingo Molnar <mingo@kernel.org> - 2017-08-12 01:40 +0200
  [PATCH 1/5] clocksource/drivers/arm_arch_timer: Fix mem frame loop initialization Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-08-11 16:20 +0200
    [PATCH 5/5] clocksource/drivers/arm_arch_timer: Avoid infinite recursion when ftrace is enabled Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-08-11 16:20 +0200
    [PATCH 2/5] clocksource/drivers/em_sti: Fix error return codes in em_sti_probe() Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-08-11 16:20 +0200
    [PATCH 3/5] clocksource/drivers/timer-of: Checking for IS_ERR() instead of NULL Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-08-11 16:20 +0200
    [PATCH 4/5] clocksource/drivers/Kconfig: Fix CLKSRC_PISTACHIO dependencies Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-08-11 16:20 +0200
  Re: [GIT PULL] clockevents: fixes for 4.13-rc4 Ingo Molnar <mingo@kernel.org> - 2017-08-13 11:50 +0200

csiph-web