mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Platschek <andreas.platschek@opentech.at>
To: linux-kernel@vger.kernel.org
Cc: a.zummo@towertech.it, alexandre.belloni@free-electrons.com,
	linux-rtc@vger.kernel.org,
	Andreas Platschek <andreas.platschek@opentech.at>
Subject: [PATCH 2/2] rtc: omap: fix unbalanced clk_prepare_enable/clk_disable_unprepare
Date: Wed,  6 Dec 2017 20:42:38 +0100	[thread overview]
Message-ID: <20171206194238.12824-3-andreas.platschek@opentech.at> (raw)
In-Reply-To: <20171206194238.12824-1-andreas.platschek@opentech.at>

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(-)

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);
-- 
2.11.0

  parent reply	other threads:[~2017-12-06 19:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06 19:42 [PATCH 0/2] rtc: omap: clk_prepare_enable error handling Andreas Platschek
2017-12-06 19:42 ` [PATCH 1/2] rtc: omap: check for clk_prepare_enable() error Andreas Platschek
2017-12-18 21:42   ` Alexandre Belloni
2017-12-06 19:42 ` Andreas Platschek [this message]
2017-12-18 21:49   ` [PATCH 2/2] rtc: omap: fix unbalanced clk_prepare_enable/clk_disable_unprepare Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171206194238.12824-3-andreas.platschek@opentech.at \
    --to=andreas.platschek@opentech.at \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®