diff mbox series

[2/2] rtc: omap: fix unbalanced clk_prepare_enable/clk_disable_unprepare

Message ID 20171206194238.12824-3-andreas.platschek@opentech.at
State Accepted
Headers show
Series rtc: omap: clk_prepare_enable error handling | expand

Commit Message

Andreas Platschek Dec. 6, 2017, 7:42 p.m. UTC
There are 2 error paths after clk_prepare_enable() was called, where
clk_disable_unprepare() is missing.

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

Signed-off-by: Andreas Platschek <andreas.platschek@opentech.at>
---
 drivers/rtc/rtc-omap.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Alexandre Belloni Dec. 18, 2017, 9:49 p.m. UTC | #1
On 06/12/2017 at 20:42:38 +0100, Andreas Platschek wrote:
> There are 2 error paths after clk_prepare_enable() was called, where
> clk_disable_unprepare() is missing.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Andreas Platschek <andreas.platschek@opentech.at>
> ---
>  drivers/rtc/rtc-omap.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
Applied, thanks.
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index ad309feb7d11..c6aa8f94bb3c 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -760,8 +760,10 @@  static int omap_rtc_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	rtc->base = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(rtc->base))
+	if (IS_ERR(rtc->base)) {
+		clk_disable_unprepare(rtc->clk);
 		return PTR_ERR(rtc->base);
+	}
 
 	platform_set_drvdata(pdev, rtc);
 
@@ -894,6 +896,7 @@  static int omap_rtc_probe(struct platform_device *pdev)
 	return 0;
 
 err:
+	clk_disable_unprepare(rtc->clk);
 	device_init_wakeup(&pdev->dev, false);
 	rtc->type->lock(rtc);
 	pm_runtime_put_sync(&pdev->dev);