Linux Serial subsystem development
 help / color / mirror / Atom feed
* [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

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