rtc: mxc_v2: Add missing clk_disable_unprepare()
authorGUO Zihua <guozihua@huawei.com>
Tue, 22 Nov 2022 08:50:46 +0000 (16:50 +0800)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Thu, 15 Dec 2022 22:34:31 +0000 (23:34 +0100)
The call to clk_disable_unprepare() is left out in the error handling of
devm_rtc_allocate_device. Add it back.

Fixes: 5490a1e018a4 ("rtc: mxc_v2: fix possible race condition")
Signed-off-by: GUO Zihua <guozihua@huawei.com>
Link: https://lore.kernel.org/r/20221122085046.21689-1-guozihua@huawei.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-mxc_v2.c

index 5e03834..f6d2ad9 100644 (file)
@@ -336,8 +336,10 @@ static int mxc_rtc_probe(struct platform_device *pdev)
        }
 
        pdata->rtc = devm_rtc_allocate_device(&pdev->dev);
-       if (IS_ERR(pdata->rtc))
+       if (IS_ERR(pdata->rtc)) {
+               clk_disable_unprepare(pdata->clk);
                return PTR_ERR(pdata->rtc);
+       }
 
        pdata->rtc->ops = &mxc_rtc_ops;
        pdata->rtc->range_max = U32_MAX;