[PATCH 4.18 073/145] rtc: omap: fix resource leak in registration error path
From: Greg Kroah-Hartman
Date: Fri Sep 07 2018 - 17:15:59 EST
4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <johan@xxxxxxxxxx>
commit 551757eb052986ec81cebcc6301cc1c4f8dca938 upstream.
Make sure to deregister the pin controller in case rtc registration
fails.
Fixes: 57072758623f ("rtc: omap: switch to rtc_register_device")
Cc: stable <stable@xxxxxxxxxxxxxxx> # 4.14
Cc: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Johan Hovold <johan@xxxxxxxxxx>
Signed-off-by: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
drivers/rtc/rtc-omap.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -880,12 +880,14 @@ static int omap_rtc_probe(struct platfor
ret = rtc_register_device(rtc->rtc);
if (ret)
- goto err;
+ goto err_deregister_pinctrl;
rtc_nvmem_register(rtc->rtc, &omap_rtc_nvmem_config);
return 0;
+err_deregister_pinctrl:
+ pinctrl_unregister(rtc->pctldev);
err:
clk_disable_unprepare(rtc->clk);
device_init_wakeup(&pdev->dev, false);