From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Steve Twiss <stwiss.opensource@diasemi.com>
Cc: LINUXKERNEL <linux-kernel@vger.kernel.org>,
RTC-LINUX <rtc-linux@googlegroups.com>,
Support Opensource <support.opensource@diasemi.com>
Subject: Re: [PATCH V1] rtc: da9053: fix access ordering error during RTC interrupt at system power on
Date: Tue, 19 Apr 2016 00:34:14 +0200 [thread overview]
Message-ID: <20160418223414.GB25196@piout.net> (raw)
In-Reply-To: <20160414111014.BB8B73FB1D@swsrvapps-01.diasemi.com>
On 14/04/2016 at 12:04:54 +0100, Steve Twiss wrote :
> From: Steve Twiss <stwiss.opensource@diasemi.com>
>
> This fix alters the ordering of the IRQ and device registrations in the RTC
> driver probe function. This change will apply to the RTC driver that supports
> both DA9052 and DA9053 PMICs.
>
> A problem could occur with the existing RTC driver if:
>
> A system is started from a cold boot using the PMIC RTC IRQ to initiate a
> power on operation. For instance, if an RTC alarm is used to start a
> platform from power off.
> The existing driver IRQ is requested before the device has been properly
> registered.
>
> i.e.
> ret = da9052_request_irq()
> comes before
> rtc->rtc = devm_rtc_device_register();
>
> In this case, an interrupt exists before the device has been registered and
> the IRQ handler can be called immediately: this can happen be before the
> memory for rtc->rtc has been allocated. The IRQ handler da9052_rtc_irq()
> contains the function call:
>
> rtc_update_irq(rtc->rtc, 1, RTC_IRQF | RTC_AF);
>
> which in turn tries to access the unavailable rtc->rtc.
>
> The fix is to reorder the functions inside the RTC probe. The IRQ is
> requested after the RTC device resource has been registered so that
> da9052_request_irq() is the last thing to happen.
>
> Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com>
>
Applied, thanks.
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
prev parent reply other threads:[~2016-04-18 22:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-14 11:04 Steve Twiss
2016-04-18 22:34 ` Alexandre Belloni [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160418223414.GB25196@piout.net \
--to=alexandre.belloni@free-electrons.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rtc-linux@googlegroups.com \
--cc=stwiss.opensource@diasemi.com \
--cc=support.opensource@diasemi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®