linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtc: brcmstb-waketimer: fix error handling in brcmstb_waketmr_probe()
@ 2017-11-17 21:15 Alexey Khoroshilov
  2017-11-17 23:51 ` Florian Fainelli
  2017-11-29 21:11 ` Alexandre Belloni
  0 siblings, 2 replies; 3+ messages in thread
From: Alexey Khoroshilov @ 2017-11-17 21:15 UTC (permalink / raw)
  To: linux-arm-kernel

brcmstb_waketmr_probe() does not disable timer->clk on error paths.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 drivers/rtc/rtc-brcmstb-waketimer.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-brcmstb-waketimer.c b/drivers/rtc/rtc-brcmstb-waketimer.c
index 796ac792a381..6cee61201c30 100644
--- a/drivers/rtc/rtc-brcmstb-waketimer.c
+++ b/drivers/rtc/rtc-brcmstb-waketimer.c
@@ -253,7 +253,7 @@ static int brcmstb_waketmr_probe(struct platform_device *pdev)
 	ret = devm_request_irq(dev, timer->irq, brcmstb_waketmr_irq, 0,
 			       "brcmstb-waketimer", timer);
 	if (ret < 0)
-		return ret;
+		goto err_clk;
 
 	timer->reboot_notifier.notifier_call = brcmstb_waketmr_reboot;
 	register_reboot_notifier(&timer->reboot_notifier);
@@ -262,12 +262,21 @@ static int brcmstb_waketmr_probe(struct platform_device *pdev)
 					 &brcmstb_waketmr_ops, THIS_MODULE);
 	if (IS_ERR(timer->rtc)) {
 		dev_err(dev, "unable to register device\n");
-		unregister_reboot_notifier(&timer->reboot_notifier);
-		return PTR_ERR(timer->rtc);
+		ret = PTR_ERR(timer->rtc);
+		goto err_notifier;
 	}
 
 	dev_info(dev, "registered, with irq %d\n", timer->irq);
 
+	return 0;
+
+err_notifier:
+	unregister_reboot_notifier(&timer->reboot_notifier);
+
+err_clk:
+	if (timer->clk)
+		clk_disable_unprepare(timer->clk);
+
 	return ret;
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] rtc: brcmstb-waketimer: fix error handling in brcmstb_waketmr_probe()
  2017-11-17 21:15 [PATCH] rtc: brcmstb-waketimer: fix error handling in brcmstb_waketmr_probe() Alexey Khoroshilov
@ 2017-11-17 23:51 ` Florian Fainelli
  2017-11-29 21:11 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2017-11-17 23:51 UTC (permalink / raw)
  To: linux-arm-kernel

On 11/17/2017 01:15 PM, Alexey Khoroshilov wrote:
> brcmstb_waketmr_probe() does not disable timer->clk on error paths.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>

Fixes: c4f07ecee22e ("rtc: brcmstb-waketimer: Add Broadcom STB wake-timer")
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] rtc: brcmstb-waketimer: fix error handling in brcmstb_waketmr_probe()
  2017-11-17 21:15 [PATCH] rtc: brcmstb-waketimer: fix error handling in brcmstb_waketmr_probe() Alexey Khoroshilov
  2017-11-17 23:51 ` Florian Fainelli
@ 2017-11-29 21:11 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2017-11-29 21:11 UTC (permalink / raw)
  To: linux-arm-kernel

On 18/11/2017 at 00:15:58 +0300, Alexey Khoroshilov wrote:
> brcmstb_waketmr_probe() does not disable timer->clk on error paths.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> ---
>  drivers/rtc/rtc-brcmstb-waketimer.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
Applied, thanks.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-29 21:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-17 21:15 [PATCH] rtc: brcmstb-waketimer: fix error handling in brcmstb_waketmr_probe() Alexey Khoroshilov
2017-11-17 23:51 ` Florian Fainelli
2017-11-29 21:11 ` 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).