summary refs log tree commit diff
path: root/drivers/rtc/rtc-omap.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2018-07-04 11:05:56 +0200
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2018-07-12 20:31:18 +0200
commit551757eb052986ec81cebcc6301cc1c4f8dca938 (patch)
treeb42c957895447a9ebee31d986612c0db2d10df98 /drivers/rtc/rtc-omap.c
parent5c8b84f410b3819d14cb1ebf32e4b3714b5a6e0b (diff)
downloadlinux-551757eb052986ec81cebcc6301cc1c4f8dca938.tar.gz
rtc: omap: fix resource leak in registration error path
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>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-omap.c')
-rw-r--r--drivers/rtc/rtc-omap.c4
1 files changed, 3 insertions, 1 deletions
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);