[PATCH 1/2] serial: owl: Disable the clock when uart_add_one_port() fails
From: Arina Kharlamova via B4 Relay
Date: Tue Dec 01 2026 - 14:19:08 EST
From: Arina Kharlamova <arina.kharlamova@xxxxxxxxxxxx>
owl_uart_probe() enables the port clock with clk_prepare_enable()
before it registers the port. If uart_add_one_port() fails, probe
clears the owl_uart_ports[] slot and returns the error, but the clock
is left prepared and enabled. owl_uart_remove() is not called after a
failed probe, so nothing disables it.
Call clk_disable_unprepare() on this path too, as is already done when
the clock rate is zero.
Fixes: abf42d2f333b ("tty: serial: owl: add "much needed" clk_prepare_enable()")
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <error27@xxxxxxxxx>
Closes: https://lore.kernel.org/r/202609160937.OilPQS0m-lkp@xxxxxxxxx/
Signed-off-by: Arina Kharlamova <arina.kharlamova@xxxxxxxxxxxx>
---
drivers/tty/serial/owl-uart.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/owl-uart.c b/drivers/tty/serial/owl-uart.c
index 863363ddad00..98e6c1fec66f 100644
--- a/drivers/tty/serial/owl-uart.c
+++ b/drivers/tty/serial/owl-uart.c
@@ -713,8 +713,10 @@ static int owl_uart_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, owl_port);
ret = uart_add_one_port(&owl_uart_driver, &owl_port->port);
- if (ret)
+ if (ret) {
owl_uart_ports[pdev->id] = NULL;
+ clk_disable_unprepare(owl_port->clk);
+ }
return ret;
}
--
Git-157)