[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180704090558.16647-2-johan@kernel.org>
Date: Wed, 4 Jul 2018 11:05:55 +0200
From: Johan Hovold <johan@...nel.org>
To: Alexandre Belloni <alexandre.belloni@...tlin.com>
Cc: Alessandro Zummo <a.zummo@...ertech.it>, linux-rtc@...r.kernel.org,
linux-kernel@...r.kernel.org, Keerthy <j-keerthy@...com>,
Johan Hovold <johan@...nel.org>,
stable <stable@...r.kernel.org>,
Marcin Niestroj <m.niestroj@...nn-global.com>,
Tony Lindgren <tony@...mide.com>
Subject: [PATCH 1/4] rtc: omap: fix potential crash on power off
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@...r.kernel.org> # 4.9
Cc: Marcin Niestroj <m.niestroj@...nn-global.com>
Cc: Tony Lindgren <tony@...mide.com>
Signed-off-by: Johan Hovold <johan@...nel.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
Powered by blists - more mailing lists