rtc: omap: fix resource leak in registration error path

Make sure to deregister the pin controller in case rtc registration
fails.

Fixes: 5707275862 ("rtc: omap: switch to rtc_register_device")
Cc: stable <[email protected]>     # 4.14
Cc: Alexandre Belloni <[email protected]>
Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
This commit is contained in:
Johan Hovold 2018-07-04 11:05:56 +02:00 • committed by Alexandre Belloni
commit 551757eb05

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