Commit 5c8b84f4 authored by Johan Hovold's avatar Johan Hovold Committed by Alexandre Belloni

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: 97ea1906 ("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: default avatarJohan Hovold <johan@kernel.org>
Acked-by: default avatarTony Lindgren <tony@atomide.com>
Reviewed-by: default avatarMarcin Niestroj <m.niestroj@grinn-global.com>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent 2b4f07e9
...@@ -861,13 +861,6 @@ static int omap_rtc_probe(struct platform_device *pdev) ...@@ -861,13 +861,6 @@ static int omap_rtc_probe(struct platform_device *pdev)
goto err; 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 */ /* Support ext_wakeup pinconf */
rtc_pinctrl_desc.name = dev_name(&pdev->dev); rtc_pinctrl_desc.name = dev_name(&pdev->dev);
...@@ -884,6 +877,13 @@ static int omap_rtc_probe(struct platform_device *pdev) ...@@ -884,6 +877,13 @@ static int omap_rtc_probe(struct platform_device *pdev)
rtc_nvmem_register(rtc->rtc, &omap_rtc_nvmem_config); 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; return 0;
err: err:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment