Skip to content

Commit

Permalink
clocksource/drivers/owl: Improve owl_timer_init fail messages
Browse files Browse the repository at this point in the history
Check the return from clocksource_mmio_init, add messages in case of
an error and in case of not having a defined clock property.

Signed-off-by: Matheus Castello <matheus@castello.eng.br>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20200219004810.411190-1-matheus@castello.eng.br
  • Loading branch information
Matheus Castello authored and Daniel Lezcano committed Feb 27, 2020
1 parent ca7b72b commit ad1ded9
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions drivers/clocksource/timer-owl.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,24 @@ static int __init owl_timer_init(struct device_node *node)
}

clk = of_clk_get(node, 0);
if (IS_ERR(clk))
return PTR_ERR(clk);
if (IS_ERR(clk)) {
ret = PTR_ERR(clk);
pr_err("Failed to get clock for clocksource (%d)\n", ret);
return ret;
}

rate = clk_get_rate(clk);

owl_timer_reset(owl_clksrc_base);
owl_timer_set_enabled(owl_clksrc_base, true);

sched_clock_register(owl_timer_sched_read, 32, rate);
clocksource_mmio_init(owl_clksrc_base + OWL_Tx_VAL, node->name,
rate, 200, 32, clocksource_mmio_readl_up);
ret = clocksource_mmio_init(owl_clksrc_base + OWL_Tx_VAL, node->name,
rate, 200, 32, clocksource_mmio_readl_up);
if (ret) {
pr_err("Failed to register clocksource (%d)\n", ret);
return ret;
}

owl_timer_reset(owl_clkevt_base);

Expand Down

0 comments on commit ad1ded9

Please sign in to comment.