All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Keerthy <j-keerthy@ti.com>, Johan Hovold <johan@kernel.org>,
	stable <stable@vger.kernel.org>,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>
Subject: [PATCH 2/4] rtc: omap: fix resource leak in registration error path
Date: Wed,  4 Jul 2018 11:05:56 +0200	[thread overview]
Message-ID: <20180704090558.16647-3-johan@kernel.org> (raw)
In-Reply-To: <20180704090558.16647-1-johan@kernel.org>

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

  parent reply	other threads:[~2018-07-04  9:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Johan Hovold [this message]
2018-07-04  9:05 ` [PATCH 3/4] rtc: omap: add missing register lock in error path 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

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=20180704090558.16647-3-johan@kernel.org \
    --to=johan@kernel.org \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=j-keerthy@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=stable@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.