]> git.baikalelectronics.ru Git - kernel.git/commitdiff
rtc: mxc_v2: Add missing clk_disable_unprepare()
authorGUO Zihua <guozihua@huawei.com>
Tue, 22 Nov 2022 08:50:46 +0000 (16:50 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:41:32 +0000 (11:41 +0100)
[ Upstream commit 55d5a86618d3b1a768bce01882b74cbbd2651975 ]

The call to clk_disable_unprepare() is left out in the error handling of
devm_rtc_allocate_device. Add it back.

Fixes: a64159f6783c ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/rtc/rtc-mxc_v2.c

index d349cef09cb7c29eb4c8d2a7f6f370a599194767..48595b00ebb39fb0c2a5d4925a34507379d1b2a4 100644 (file)
@@ -337,8 +337,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;