* [PATCH] media: exynos4-is: Release clocks if enabling the bus clock fails
@ 2026-11-03 9:06 Wentao Liang
2026-11-03 9:16 ` Krzysztof Kozlowski
0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-11-03 9:06 UTC (permalink / raw)
To: Sylwester Nawrocki, Mauro Carvalho Chehab, Krzysztof Kozlowski,
Peter Griffin, Alim Akhtar
Cc: linux-media, linux-arm-kernel, linux-samsung-soc, linux-kernel,
Wentao Liang, stable
fimc_clk_get() acquires and prepares all of the FIMC clocks. If the
subsequent clk_set_rate() or clk_enable() call on the bus clock fails,
fimc_probe() returns immediately without calling fimc_clk_put(), leaking
the clock references and leaving the clocks prepared.
Jump to a common cleanup label that releases the clocks on both failures.
Fixes: b71b56b264ae ("[media] s5p-fimc: Check return value of clk_enable/clk_set_rate")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/media/platform/samsung/exynos4-is/fimc-core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-core.c b/drivers/media/platform/samsung/exynos4-is/fimc-core.c
index 57e573949e54..b36812ad25c0 100644
--- a/drivers/media/platform/samsung/exynos4-is/fimc-core.c
+++ b/drivers/media/platform/samsung/exynos4-is/fimc-core.c
@@ -977,11 +977,11 @@ static int fimc_probe(struct platform_device *pdev)
ret = clk_set_rate(fimc->clock[CLK_BUS], lclk_freq);
if (ret < 0)
- return ret;
+ goto err_clk_put;
ret = clk_enable(fimc->clock[CLK_BUS]);
if (ret < 0)
- return ret;
+ goto err_clk_put;
ret = devm_request_irq(dev, irq, fimc_irq_handler,
0, dev_name(dev), fimc);
@@ -1012,6 +1012,7 @@ static int fimc_probe(struct platform_device *pdev)
fimc_unregister_capture_subdev(fimc);
err_sclk:
clk_disable(fimc->clock[CLK_BUS]);
+err_clk_put:
fimc_clk_put(fimc);
return ret;
}
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] media: exynos4-is: Release clocks if enabling the bus clock fails
2026-11-03 9:06 [PATCH] media: exynos4-is: Release clocks if enabling the bus clock fails Wentao Liang
@ 2026-11-03 9:16 ` Krzysztof Kozlowski
0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Kozlowski @ 2026-11-03 9:16 UTC (permalink / raw)
To: Wentao Liang, Sylwester Nawrocki, Mauro Carvalho Chehab,
Peter Griffin, Alim Akhtar
Cc: linux-media, linux-arm-kernel, linux-samsung-soc, linux-kernel, stable
On 03/11/2026 10:06, Wentao Liang wrote:
> fimc_clk_get() acquires and prepares all of the FIMC clocks. If the
> subsequent clk_set_rate() or clk_enable() call on the bus clock fails,
> fimc_probe() returns immediately without calling fimc_clk_put(), leaking
> the clock references and leaving the clocks prepared.
>
> Jump to a common cleanup label that releases the clocks on both failures.
>
> Fixes: b71b56b264ae ("[media] s5p-fimc: Check return value of clk_enable/clk_set_rate")
> Cc: stable@vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
You just don't bother to read replies, right?
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-03 9:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 9:06 [PATCH] media: exynos4-is: Release clocks if enabling the bus clock fails Wentao Liang
2026-11-03 9:16 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®