]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commit
clocksource/drivers/kona: Fix get_counter() error handling
authorArnd Bergmann <arnd@arndb.de>
Wed, 17 Aug 2016 10:21:34 +0000 (12:21 +0200)
committerIngo Molnar <mingo@kernel.org>
Wed, 17 Aug 2016 11:08:31 +0000 (13:08 +0200)
commit16c8eba0fe01e03317f48868105103a8f5938e85
tree0251addbaf555eeafadeddaccc9d7e3a7eb82728
parent0e62fd836e4c2908cc1e32c68806529b4f859955
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 <arnd@arndb.de>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Ray Jui <ray.jui@broadcom.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: bcm-kernel-feedback-list@broadcom.com
Link: http://lkml.kernel.org/r/1471429296-9053-2-git-send-email-daniel.lezcano@linaro.org
Link: https://patchwork.kernel.org/patch/9174261/
Signed-off-by: Ingo Molnar <mingo@kernel.org>
drivers/clocksource/bcm_kona_timer.c