clocksource/drivers/kona: Fix get_counter() error handling
I could not figure out why, but GCC cannot prove that the
kona_timer_init() function always initializes its two outputs,
and we get a warning for the use of the 'lsw' variable later,
which is obviously correct.
drivers/clocksource/bcm_kona_timer.c: In function 'kona_timer_init':
drivers/clocksource/bcm_kona_timer.c:119:13: error: 'lsw' may be used uninitialized in this function [-Werror=maybe-uninitialized]
Slightly reordering the loop makes the warning disappear, after
it becomes more obvious to the compiler that the loop is
always entered on the first iteration.
As pointed out by Ray Jui, there is a related problem in the
way we deal with the loop running into the limit, as we just
keep going there with an invalid counter data, so instead we
now propagate a -ETIMEDOUT result to the caller.
Signed-off-by: Arnd Bergmann <email@example.com>
Signed-off-by: Daniel Lezcano <firstname.lastname@example.org>
Acked-by: Ray Jui <email@example.com>
Cc: Linus Torvalds <firstname.lastname@example.org>
Cc: Peter Zijlstra <email@example.com>
Cc: Thomas Gleixner <firstname.lastname@example.org>
Signed-off-by: Ingo Molnar <email@example.com>
1 file changed