diff options
author | Matthias Kaehlcke <mka@chromium.org> | 2017-07-31 14:37:28 -0400 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2017-08-10 08:48:17 -0400 |
commit | d197f7988721221fac64f899efd7657c15281810 (patch) | |
tree | 82d4093b5b9c6cda12750553442887be788f0f2a | |
parent | 34f41c0316ed52b0b44542491d89278efdaa70e4 (diff) |
clocksource/drivers/arm_arch_timer: Fix mem frame loop initialization
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>
-rw-r--r-- | drivers/clocksource/arm_arch_timer.c | 2 |
1 files changed, 1 insertions, 1 deletions
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) | |||
1440 | * While unlikely, it's theoretically possible that none of the frames | 1440 | * While unlikely, it's theoretically possible that none of the frames |
1441 | * in a timer expose the combination of feature we want. | 1441 | * in a timer expose the combination of feature we want. |
1442 | */ | 1442 | */ |
1443 | for (i = i; i < timer_count; i++) { | 1443 | for (i = 0; i < timer_count; i++) { |
1444 | timer = &timers[i]; | 1444 | timer = &timers[i]; |
1445 | 1445 | ||
1446 | frame = arch_timer_mem_find_best_frame(timer); | 1446 | frame = arch_timer_mem_find_best_frame(timer); |