RE: [PATCH v4] clocksource: timer-sp804: Fix read_current_timer() issue when clock source is not registered

From: stephen . eta . zhou

Date: Tue Dec 16 2025 - 00:39:11 EST


Hi Guenter,

On Mon, 15 Dec 2025 15:18:37 -0800, Guenter Roeck wrote:
> This patch results in a crash when trying to boot integratorcp in qemu.

Thank you for pointing out the problem.

> sp804_read_delay_timer_read from read_current_timer+0x24/0x44
>
> This is not surprising since sp804_read_delay_timer_read() calls
> sp804_read() which dereferences sched_clkevt. sched_clkevt is not
> initialized for integratorcp.

Thank you for pointing out this issue.
I will work on fixing it and submit a new patch as soon as possible.

> static int __init sp804_clocksource_and_sched_clock_init(void __iomem *base,
> const char *name,
> struct clk *clk,
> int use_sched_clock)
> {
> ...
> if (use_sched_clock) {
> sched_clkevt = clkevt;
> sched_clock_register(sp804_read, 32, rate);
> }
> ...
> static int __init integrator_cp_of_init(struct device_node *np)
> {
> ...
> ret = sp804_clocksource_and_sched_clock_init(base,
> name, clk, 0);

Thanks.

Best regards,
Stephen