Skip to content

Commit

Permalink
clocksource: efm32: Fix a NULL pointer dereference
Browse files Browse the repository at this point in the history
The initialisation of the efm32 clocksource first sets up the irq and only
after that initialises the data needed for irq handling. In case this
initialisation is delayed the irq handler would dereference a NULL pointer.

I'm not aware of anything that could delay the process in such a way, but it's
better to be safe than sorry, so setup the irq only when the clock event device
is ready.

Cc: stable@vger.kernel.org
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yongbae Park <yongbae2@gmail.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
  • Loading branch information
Yongbae Park authored and Daniel Lezcano committed Mar 5, 2015
1 parent 13a7a6a commit 7b8f10d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/clocksource/time-efm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@ static int __init efm32_clockevent_init(struct device_node *np)
clock_event_ddata.base = base;
clock_event_ddata.periodic_top = DIV_ROUND_CLOSEST(rate, 1024 * HZ);

setup_irq(irq, &efm32_clock_event_irq);

clockevents_config_and_register(&clock_event_ddata.evtdev,
DIV_ROUND_CLOSEST(rate, 1024),
0xf, 0xffff);

setup_irq(irq, &efm32_clock_event_irq);

return 0;

err_get_irq:
Expand Down

0 comments on commit 7b8f10d

Please sign in to comment.