[PATCH 1/2] serial: owl: Disable the clock when uart_add_one_port() fails

Arina Kharlamova via B4 Relay devnull+arina.kharlamova.mbzuai.ac.ae at kernel.org
Tue Dec 1 11:17:51 PST 2026


From: Arina Kharlamova <arina.kharlamova at mbzuai.ac.ae>

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 at intel.com>
Reported-by: Dan Carpenter <error27 at gmail.com>
Closes: https://lore.kernel.org/r/202609160937.OilPQS0m-lkp@intel.com/
Signed-off-by: Arina Kharlamova <arina.kharlamova at mbzuai.ac.ae>
---
 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)





More information about the linux-arm-kernel mailing list