From: Malathi A <malathi.a2000@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
Kunihiko Hayashi <hayashi.kunihiko@socionext.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Cc: Malathi A <malathi.a2000@gmail.com>
Subject: [PATCH] serial: 8250_uniphier: Disable clock on probe error path
Date: Wed, 16 Sep 2026 09:54:36 +0000 [thread overview]
Message-ID: <20260916095438.20837-1-malathi.a2000@gmail.com> (raw)
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
next reply other threads:[~2026-09-16 9:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 9:54 Malathi A [this message]
2026-09-16 9:59 ` [PATCH] serial: 8250_uniphier: Disable clock on probe error path sashiko-bot
2026-09-16 11:07 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260916095438.20837-1-malathi.a2000@gmail.com \
--to=malathi.a2000@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=hayashi.kunihiko@socionext.com \
--cc=jirislaby@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=mhiramat@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.