* [PATCH] serial: vt8500: Fix clock reference leak in vt8500_serial_probe()
@ 2026-09-17 15:58 Wentao Liang
2026-09-17 16:03 ` sashiko-bot
2026-09-18 7:51 ` Alexey Charkov
0 siblings, 2 replies; 3+ messages in thread
From: Wentao Liang @ 2026-09-17 15:58 UTC (permalink / raw)
To: alchark
Cc: gregkh, jirislaby, krzk, linux-arm-kernel, linux-kernel,
linux-serial, linux, Wentao Liang, stable
of_clk_get() returns a clock with a reference that has to be released
with clk_put(). If clk_prepare_enable() fails the function returns
without doing so, leaking the reference.
Add the missing clk_put() on that error path.
Fixes: 12faa35ae5cb ("serial: vt8500: UART uses gated clock rather than 24Mhz reference")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/tty/serial/vt8500_serial.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c
index 78a1c1eea11b..fc6fdc751b16 100644
--- a/drivers/tty/serial/vt8500_serial.c
+++ b/drivers/tty/serial/vt8500_serial.c
@@ -656,6 +656,7 @@ static int vt8500_serial_probe(struct platform_device *pdev)
ret = clk_prepare_enable(vt8500_port->clk);
if (ret) {
dev_err(&pdev->dev, "failed to enable clock\n");
+ clk_put(vt8500_port->clk);
return ret;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] serial: vt8500: Fix clock reference leak in vt8500_serial_probe()
2026-09-17 15:58 [PATCH] serial: vt8500: Fix clock reference leak in vt8500_serial_probe() Wentao Liang
@ 2026-09-17 16:03 ` sashiko-bot
2026-09-18 7:51 ` Alexey Charkov
1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-09-17 16:03 UTC (permalink / raw)
To: Wentao Liang; +Cc: linux-serial
> of_clk_get() returns a clock with a reference that has to be released
> with clk_put(). If clk_prepare_enable() fails the function returns
> without doing so, leaking the reference.
>
> Add the missing clk_put() on that error path.
>
> Fixes: 12faa35ae5cb ("serial: vt8500: UART uses gated clock rather than 24Mhz reference")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260917155834.2161361-1-vulab@iscas.ac.cn?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] serial: vt8500: Fix clock reference leak in vt8500_serial_probe()
2026-09-17 15:58 [PATCH] serial: vt8500: Fix clock reference leak in vt8500_serial_probe() Wentao Liang
2026-09-17 16:03 ` sashiko-bot
@ 2026-09-18 7:51 ` Alexey Charkov
1 sibling, 0 replies; 3+ messages in thread
From: Alexey Charkov @ 2026-09-18 7:51 UTC (permalink / raw)
To: Wentao Liang
Cc: gregkh, jirislaby, krzk, linux-arm-kernel, linux-kernel,
linux-serial, linux, stable
On Thu, Sep 17, 2026 at 7:58 PM Wentao Liang <vulab@iscas.ac.cn> wrote:
>
> of_clk_get() returns a clock with a reference that has to be released
> with clk_put(). If clk_prepare_enable() fails the function returns
> without doing so, leaking the reference.
>
> Add the missing clk_put() on that error path.
>
> Fixes: 12faa35ae5cb ("serial: vt8500: UART uses gated clock rather than 24Mhz reference")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> drivers/tty/serial/vt8500_serial.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c
> index 78a1c1eea11b..fc6fdc751b16 100644
> --- a/drivers/tty/serial/vt8500_serial.c
> +++ b/drivers/tty/serial/vt8500_serial.c
> @@ -656,6 +656,7 @@ static int vt8500_serial_probe(struct platform_device *pdev)
> ret = clk_prepare_enable(vt8500_port->clk);
> if (ret) {
> dev_err(&pdev->dev, "failed to enable clock\n");
> + clk_put(vt8500_port->clk);
The probe function currently mixes devm-managed and manual resource
allocations, with the clk standing out in particular. Instead of
adding a manual clk_put, could you please switch the clk calls to
devm_clk_get_enabled and drop redundant boilerplate?
Best regards,
Alexey
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-18 7:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-17 15:58 [PATCH] serial: vt8500: Fix clock reference leak in vt8500_serial_probe() Wentao Liang
2026-09-17 16:03 ` sashiko-bot
2026-09-18 7:51 ` Alexey Charkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox