Re: [PATCH] clocksource/drivers/tango-xtal: Fix incorrect test

From: Daniel Lezcano
Date: Wed Apr 20 2016 - 00:56:01 EST


[ ... ]

> About the error handling... you advised against panic()
> because there might be other clock sources.
>
> Does it makes sense to give up registering sched_clock
> and delay_timer when the clocksource registration fails?

Actually, all the problem is coming from the CLOCKSOURCE_OF_DECLARE where
the init_func is a void (*init_func)(struct device_node *) signature, thus
not allowing to return a value.

Because of that, the init code path of the different drivers are somewhat
fuzzy when an error occurs.

If the function could return an error code, then the drivers would be
written in a way to catch and handle the errors gracefully. That implies the
clocksource-probe() routine will be able to detect when the init_func() is
failing, trace it and count if one clocksource/clockevent succeed at boot
time.

So because the latter, it would make sense to give up registering and leave
a clean place in the init function when something is going wrong.

-- Daniel