Re: [RESEND] rtc: snvs: Fix usage of snvs_rtc_enable

From: Trent Piepho
Date: Wed Mar 28 2018 - 20:12:26 EST


On Wed, 2018-03-28 at 20:14 +0100, Bryan O'Donoghue wrote:
> commit 179a502f8c46 ("rtc: snvs: add Freescale rtc-snvs driver") introduces
> the SNVS RTC driver with a function snvs_rtc_enable().
>
> snvs_rtc_enable() can return an error on the enable path however this
> driver does not currently trap that failure on the probe() path and
> consequently if enabling the RTC fails we encounter a later error spinning
> forever in rtc_write_sync_lp().
>
> This patch fixes by parsing the result of rtc_write_sync_lp() and
> propagating both in the probe and elsewhere. If the RTC doesn't start we
> don't proceed loading the driver and don't get into this loop mess later
> on.
>

I sent a patch a couple weeks ago that addressed a similar issue, see
https://patchwork.ozlabs.org/patch/887090/

Does this also fix the problem you see?

I think what you've done will prevent the driver from loading if the
clock is not working, but if the clock does not tick properly after
loading, there are still points (snvs_rtc_read_time for one) that will
lock up in the kernel.