]> git.baikalelectronics.ru Git - kernel.git/commit
clocksource/drivers/timer-of: Handle of_irq_get_byname() result correctly
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Mon, 17 Jul 2017 18:00:44 +0000 (21:00 +0300)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 17 Jul 2017 20:43:00 +0000 (22:43 +0200)
commita8b442a3c32156ad7c04099a5a70d5bd481710ac
tree8f6963fb7d9e6385bfa3e77617c9f050066a549b
parent36b66da92ee7c2b877785be3708e6f816e9974a9
clocksource/drivers/timer-of: Handle of_irq_get_byname() result correctly

of_irq_get_byname() may return a negative error number as well as 0 on
failure, while timer_irq_init() only checks for 0, blithely continuing with
the call to request_[percpu_]irq() -- those functions expect *unsigned int*,
so would probably fail anyway when a large IRQ number resulting from a
conversion of a negative error number is passed to them... This, however,
is incorrect behavior -- error number is not IRQ number.

Filter out the negative error numbers, complain, and return them to the
timer_irq_init()'s callers...

Fixes: a4b7e0a68dba ("clocksource/drivers: Add timer-of common init routine")
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: http://lkml.kernel.org/r/20170717180114.678825147@cogentembedded.com
drivers/clocksource/timer-of.c