* [PATCH 0/4] rtc: omap: fixes and clean ups
@ 2018-07-04 9:05 Johan Hovold
2018-07-04 9:05 ` [PATCH 1/4] rtc: omap: fix potential crash on power off Johan Hovold
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Johan Hovold @ 2018-07-04 9:05 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Alessandro Zummo, linux-rtc, linux-kernel, Keerthy, Johan Hovold
Here are a couple of fixes for issues discovered through inspection
along with some clean ups.
Johan
Johan Hovold (4):
rtc: omap: fix potential crash on power off
rtc: omap: fix resource leak in registration error path
rtc: omap: add missing register lock in error path
rtc: omap: drop unnecessary register unlock around reads
drivers/rtc/rtc-omap.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
--
2.18.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/4] rtc: omap: fix potential crash on power off
2018-07-04 9:05 [PATCH 0/4] rtc: omap: fixes and clean ups Johan Hovold
@ 2018-07-04 9:05 ` Johan Hovold
2018-07-05 8:31 ` 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
` (3 subsequent siblings)
4 siblings, 2 replies; 8+ messages in thread
From: Johan Hovold @ 2018-07-04 9:05 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Alessandro Zummo, linux-rtc, linux-kernel, Keerthy, Johan Hovold,
stable, Marcin Niestroj, Tony Lindgren
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/4] rtc: omap: fix resource leak in registration error path
2018-07-04 9:05 [PATCH 0/4] rtc: omap: fixes and clean ups Johan Hovold
2018-07-04 9:05 ` [PATCH 1/4] rtc: omap: fix potential crash on power off Johan Hovold
@ 2018-07-04 9:05 ` Johan Hovold
2018-07-04 9:05 ` [PATCH 3/4] rtc: omap: add missing register lock in " Johan Hovold
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Johan Hovold @ 2018-07-04 9:05 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Alessandro Zummo, linux-rtc, linux-kernel, Keerthy, Johan Hovold,
stable, Alexandre Belloni
Make sure to deregister the pin controller in case rtc registration
fails.
Fixes: 57072758623f ("rtc: omap: switch to rtc_register_device")
Cc: stable <stable@vger.kernel.org> # 4.14
Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/rtc/rtc-omap.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index c214b69a8787..6a7b804c3074 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -873,7 +873,7 @@ static int omap_rtc_probe(struct platform_device *pdev)
ret = rtc_register_device(rtc->rtc);
if (ret)
- goto err;
+ goto err_deregister_pinctrl;
rtc_nvmem_register(rtc->rtc, &omap_rtc_nvmem_config);
@@ -886,6 +886,8 @@ static int omap_rtc_probe(struct platform_device *pdev)
return 0;
+err_deregister_pinctrl:
+ pinctrl_unregister(rtc->pctldev);
err:
clk_disable_unprepare(rtc->clk);
device_init_wakeup(&pdev->dev, false);
--
2.18.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/4] rtc: omap: add missing register lock in error path
2018-07-04 9:05 [PATCH 0/4] rtc: omap: fixes and clean ups Johan Hovold
2018-07-04 9:05 ` [PATCH 1/4] rtc: omap: fix potential crash on power off Johan Hovold
2018-07-04 9:05 ` [PATCH 2/4] rtc: omap: fix resource leak in registration error path Johan Hovold
@ 2018-07-04 9:05 ` 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
4 siblings, 0 replies; 8+ messages in thread
From: Johan Hovold @ 2018-07-04 9:05 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Alessandro Zummo, linux-rtc, linux-kernel, Keerthy, Johan Hovold
For completeness re-lock the registers also in the power-off error path.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/rtc/rtc-omap.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index 6a7b804c3074..7f9ee559dd99 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -449,6 +449,7 @@ static void omap_rtc_power_off(void)
if (tm2bcd(&tm) < 0) {
dev_err(&rtc->rtc->dev, "power off failed\n");
+ rtc->type->lock(rtc);
return;
}
--
2.18.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/4] rtc: omap: drop unnecessary register unlock around reads
2018-07-04 9:05 [PATCH 0/4] rtc: omap: fixes and clean ups Johan Hovold
` (2 preceding siblings ...)
2018-07-04 9:05 ` [PATCH 3/4] rtc: omap: add missing register lock in " Johan Hovold
@ 2018-07-04 9:05 ` Johan Hovold
2018-07-12 18:33 ` [PATCH 0/4] rtc: omap: fixes and clean ups Alexandre Belloni
4 siblings, 0 replies; 8+ messages in thread
From: Johan Hovold @ 2018-07-04 9:05 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Alessandro Zummo, linux-rtc, linux-kernel, Keerthy, Johan Hovold
Drop unnecessary register write-unlock around two read accesses.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/rtc/rtc-omap.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index 7f9ee559dd99..323ff55cc165 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -583,9 +583,7 @@ static int rtc_pinconf_get(struct pinctrl_dev *pctldev,
u32 val;
u16 arg = 0;
- rtc->type->unlock(rtc);
val = rtc_readl(rtc, OMAP_RTC_PMIC_REG);
- rtc->type->lock(rtc);
switch (param) {
case PIN_CONFIG_INPUT_ENABLE:
@@ -615,9 +613,7 @@ static int rtc_pinconf_set(struct pinctrl_dev *pctldev,
u32 param_val;
int i;
- rtc->type->unlock(rtc);
val = rtc_readl(rtc, OMAP_RTC_PMIC_REG);
- rtc->type->lock(rtc);
/* active low by default */
val |= OMAP_RTC_PMIC_EXT_WKUP_POL(pin);
--
2.18.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] rtc: omap: fix potential crash on power off
2018-07-04 9:05 ` [PATCH 1/4] rtc: omap: fix potential crash on power off Johan Hovold
@ 2018-07-05 8:31 ` Tony Lindgren
2018-07-09 9:13 ` Marcin Niestroj
1 sibling, 0 replies; 8+ messages in thread
From: Tony Lindgren @ 2018-07-05 8:31 UTC (permalink / raw)
To: Johan Hovold
Cc: Alexandre Belloni, Alessandro Zummo, linux-rtc, linux-kernel,
Keerthy, stable, Marcin Niestroj
* Johan Hovold <johan@kernel.org> [180704 09:09]:
> 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>
Looks good to me:
Acked-by: Tony Lindgren <tony@atomide.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] rtc: omap: fix potential crash on power off
2018-07-04 9:05 ` [PATCH 1/4] rtc: omap: fix potential crash on power off Johan Hovold
2018-07-05 8:31 ` Tony Lindgren
@ 2018-07-09 9:13 ` Marcin Niestroj
1 sibling, 0 replies; 8+ messages in thread
From: Marcin Niestroj @ 2018-07-09 9:13 UTC (permalink / raw)
To: Johan Hovold
Cc: Alexandre Belloni, Alessandro Zummo, linux-rtc, linux-kernel,
Keerthy, stable, Tony Lindgren
On 04.07.2018 11:05, Johan Hovold wrote:
> 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.or
Reviewed-by: Marcin Niestroj <m.niestroj@grinn-global.com>
--
Marcin Niestroj
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/4] rtc: omap: fixes and clean ups
2018-07-04 9:05 [PATCH 0/4] rtc: omap: fixes and clean ups Johan Hovold
` (3 preceding siblings ...)
2018-07-04 9:05 ` [PATCH 4/4] rtc: omap: drop unnecessary register unlock around reads Johan Hovold
@ 2018-07-12 18:33 ` Alexandre Belloni
4 siblings, 0 replies; 8+ messages in thread
From: Alexandre Belloni @ 2018-07-12 18:33 UTC (permalink / raw)
To: Johan Hovold; +Cc: Alessandro Zummo, linux-rtc, linux-kernel, Keerthy
On 04/07/2018 11:05:54+0200, Johan Hovold wrote:
> Here are a couple of fixes for issues discovered through inspection
> along with some clean ups.
>
> Johan
>
>
> Johan Hovold (4):
> rtc: omap: fix potential crash on power off
> rtc: omap: fix resource leak in registration error path
> rtc: omap: add missing register lock in error path
> rtc: omap: drop unnecessary register unlock around reads
>
> drivers/rtc/rtc-omap.c | 23 +++++++++++------------
> 1 file changed, 11 insertions(+), 12 deletions(-)
>
All applied, thanks
> --
> 2.18.0
>
--
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-07-12 18:33 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-04 9:05 [PATCH 0/4] rtc: omap: fixes and clean ups Johan Hovold
2018-07-04 9:05 ` [PATCH 1/4] rtc: omap: fix potential crash on power off Johan Hovold
2018-07-05 8:31 ` 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
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).