]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
rtc: st-lpc: Add missing clk_disable_unprepare in st_rtc_probe()
authorGaosheng Cui <cuigaosheng1@huawei.com>
Wed, 23 Nov 2022 01:48:05 +0000 (09:48 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 7 Jan 2023 11:07:29 +0000 (12:07 +0100)
[ Upstream commit 5fb733d7bd6949e90028efdce8bd528c6ab7cf1e ]

The clk_disable_unprepare() should be called in the error handling
of clk_get_rate(), fix it.

Fixes: b5b2bdfc2893 ("rtc: st: Add new driver for ST's LPC RTC")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Link: https://lore.kernel.org/r/20221123014805.1993052-1-cuigaosheng1@huawei.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/rtc/rtc-st-lpc.c

index 74c0a336ceea0650965701f93399814299275bd1..85756ef63c229157be55787020839b2623f01591 100644 (file)
@@ -249,6 +249,7 @@ static int st_rtc_probe(struct platform_device *pdev)
 
        rtc->clkrate = clk_get_rate(rtc->clk);
        if (!rtc->clkrate) {
+               clk_disable_unprepare(rtc->clk);
                dev_err(&pdev->dev, "Unable to fetch clock rate\n");
                return -EINVAL;
        }