mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] serial: 8250_uniphier: Disable clock on probe error path
@ 2026-09-16  9:54 Malathi A
  2026-09-16 11:07 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Malathi A @ 2026-09-16  9:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Kunihiko Hayashi,
	Masami Hiramatsu, Andy Shevchenko, linux-kernel, linux-serial,
	linux-arm-kernel
  Cc: Malathi A

uniphier_uart_probe() calls clk_prepare_enable() on priv->clk before it
reads the port properties, but returns directly when
uart_read_port_properties() fails, leaving the clock prepared and
enabled.

The intent is clear from the surrounding code: the next error path, when
serial8250_register_8250_port() fails, calls clk_disable_unprepare(), as
does uniphier_uart_remove(). Add the missing call so the early failure
behaves the same way.

Found by smatch:

  drivers/tty/serial/8250/8250_uniphier.c:232 uniphier_uart_probe() warn: 'priv->clk' from clk_prepare_enable() not released on lines: 205.

Fixes: 26e8349c0d76 ("serial: 8250_uniphier: Switch to use uart_read_port_properties()")
Signed-off-by: Malathi A <malathi.a2000@gmail.com>
---
 drivers/tty/serial/8250/8250_uniphier.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_uniphier.c b/drivers/tty/serial/8250/8250_uniphier.c
index e3db60bf50c9..52667c1891bb 100644
--- a/drivers/tty/serial/8250/8250_uniphier.c
+++ b/drivers/tty/serial/8250/8250_uniphier.c
@@ -201,8 +201,10 @@ static int uniphier_uart_probe(struct platform_device *pdev)
 	up.port.membase = membase;
 
 	ret = uart_read_port_properties(&up.port);
-	if (ret)
+	if (ret) {
+		clk_disable_unprepare(priv->clk);
 		return ret;
+	}
 
 	up.port.type = PORT_16550A;
 	up.port.iotype = UPIO_MEM32;
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-16 11:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16  9:54 [PATCH] serial: 8250_uniphier: Disable clock on probe error path Malathi A
2026-09-16 11:07 ` Andy Shevchenko

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®