timer: Check failure of timer_cpu_notify() before calling init_timer_stats()
authorViresh Kumar <viresh.kumar@linaro.org>
Fri, 28 Feb 2014 08:45:21 +0000 (14:15 +0530)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 4 Mar 2014 11:30:29 +0000 (12:30 +0100)
timer_cpu_notify() should return NOTIFY_OK and nothing else. Anything else would
trigger a BUG_ON(). Return value of this routine is already checked correctly
but is done after issuing a call to init_timer_stats(). The right order would be
to check the error case first and then call init_timer_stats(). Lets do it.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linaro-kernel@lists.linaro.org
Cc: fweisbec@gmail.com
Cc: tj@kernel.org
Cc: peterz@infradead.org
Link: http://lkml.kernel.org/r/c439f5b6bbc2047e1662f4d523350531425bcf9d.1393576981.git.viresh.kumar@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
kernel/timer.c

index a71bdfdb51e7a047f0f220816403b5b838e5c5d0..31824ef3eb964b6dc9a9b098dfc462530ed46705 100644 (file)
@@ -1681,9 +1681,9 @@ void __init init_timers(void)
 
        err = timer_cpu_notify(&timers_nb, (unsigned long)CPU_UP_PREPARE,
                               (void *)(long)smp_processor_id());
-       init_timer_stats();
-
        BUG_ON(err != NOTIFY_OK);
+
+       init_timer_stats();
        register_cpu_notifier(&timers_nb);
        open_softirq(TIMER_SOFTIRQ, run_timer_softirq);
 }