Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clocksource/drivers/owl: Improve owl_timer_init fail messages

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

authored by

Matheus Castello and committed by
Daniel Lezcano
ad1ded9d ca7b72b5

+11 -4
+11 -4
drivers/clocksource/timer-owl.c
··· 135 135 } 136 136 137 137 clk = of_clk_get(node, 0); 138 - if (IS_ERR(clk)) 139 - return PTR_ERR(clk); 138 + if (IS_ERR(clk)) { 139 + ret = PTR_ERR(clk); 140 + pr_err("Failed to get clock for clocksource (%d)\n", ret); 141 + return ret; 142 + } 140 143 141 144 rate = clk_get_rate(clk); 142 145 ··· 147 144 owl_timer_set_enabled(owl_clksrc_base, true); 148 145 149 146 sched_clock_register(owl_timer_sched_read, 32, rate); 150 - clocksource_mmio_init(owl_clksrc_base + OWL_Tx_VAL, node->name, 151 - rate, 200, 32, clocksource_mmio_readl_up); 147 + ret = clocksource_mmio_init(owl_clksrc_base + OWL_Tx_VAL, node->name, 148 + rate, 200, 32, clocksource_mmio_readl_up); 149 + if (ret) { 150 + pr_err("Failed to register clocksource (%d)\n", ret); 151 + return ret; 152 + } 152 153 153 154 owl_timer_reset(owl_clkevt_base); 154 155