rtc: omap: fix resource leak in registration error path
authorJohan Hovold <johan@kernel.org>
Wed, 4 Jul 2018 09:05:56 +0000 (11:05 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Thu, 12 Jul 2018 18:31:18 +0000 (20:31 +0200)
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>
drivers/rtc/rtc-omap.c

index c214b69..6a7b804 100644 (file)
@@ -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);