From: Johan Hovold <johan@kernel.org>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org,
Keerthy <j-keerthy@ti.com>, Johan Hovold <johan@kernel.org>,
stable <stable@vger.kernel.org>,
Marcin Niestroj <m.niestroj@grinn-global.com>,
Tony Lindgren <tony@atomide.com>
Subject: [PATCH 1/4] rtc: omap: fix potential crash on power off
Date: Wed, 4 Jul 2018 11:05:55 +0200 [thread overview]
Message-ID: <20180704090558.16647-2-johan@kernel.org> (raw)
In-Reply-To: <20180704090558.16647-1-johan@kernel.org>
Do not set the system power-off callback and omap power-off rtc pointer
until we're done setting up our device to avoid leaving stale pointers
around after a late probe error.
Fixes: 97ea1906b3c2 ("rtc: omap: Support ext_wakeup configuration")
Cc: stable <stable@vger.kernel.org> # 4.9
Cc: Marcin Niestroj <m.niestroj@grinn-global.com>
Cc: Tony Lindgren <tony@atomide.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/rtc/rtc-omap.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index 39086398833e..c214b69a8787 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -861,13 +861,6 @@ static int omap_rtc_probe(struct platform_device *pdev)
goto err;
}
- if (rtc->is_pmic_controller) {
- if (!pm_power_off) {
- omap_rtc_power_off_rtc = rtc;
- pm_power_off = omap_rtc_power_off;
- }
- }
-
/* Support ext_wakeup pinconf */
rtc_pinctrl_desc.name = dev_name(&pdev->dev);
@@ -884,6 +877,13 @@ static int omap_rtc_probe(struct platform_device *pdev)
rtc_nvmem_register(rtc->rtc, &omap_rtc_nvmem_config);
+ if (rtc->is_pmic_controller) {
+ if (!pm_power_off) {
+ omap_rtc_power_off_rtc = rtc;
+ pm_power_off = omap_rtc_power_off;
+ }
+ }
+
return 0;
err:
--
2.18.0
next prev parent reply other threads:[~2018-07-04 9:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-04 9:05 [PATCH 0/4] rtc: omap: fixes and clean ups Johan Hovold
2018-07-04 9:05 ` Johan Hovold [this message]
2018-07-05 8:31 ` [PATCH 1/4] rtc: omap: fix potential crash on power off Tony Lindgren
2018-07-09 9:13 ` Marcin Niestroj
2018-07-04 9:05 ` [PATCH 2/4] rtc: omap: fix resource leak in registration error path Johan Hovold
2018-07-04 9:05 ` [PATCH 3/4] rtc: omap: add missing register lock in " Johan Hovold
2018-07-04 9:05 ` [PATCH 4/4] rtc: omap: drop unnecessary register unlock around reads Johan Hovold
2018-07-12 18:33 ` [PATCH 0/4] rtc: omap: fixes and clean ups Alexandre Belloni
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=20180704090558.16647-2-johan@kernel.org \
--to=johan@kernel.org \
--cc=a.zummo@towertech.it \
--cc=alexandre.belloni@bootlin.com \
--cc=j-keerthy@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=m.niestroj@grinn-global.com \
--cc=stable@vger.kernel.org \
--cc=tony@atomide.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;
as well as URLs for NNTP newsgroup(s).