From: Jiri Slaby <jirislaby@kernel.org>
To: Gu Bin <gubin@cmss.chinamobile.com>, gregkh@linuxfoundation.org
Cc: Frank.Li@nxp.com, s.hauer@pengutronix.de, kernel@pengutronix.de,
festevam@gmail.com, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org, daniel.thompson@linaro.org
Subject: Re: [PATCH] tty: serial: imx: return error when clk_per fails in imx_uart_poll_init()
Date: Wed, 11 Nov 2026 10:21:26 +0100 [thread overview]
Message-ID: <1e584df0-c74a-454f-a580-75dc7567abe1@kernel.org> (raw)
In-Reply-To: <20261110105456.1563-1-gubin@cmss.chinamobile.com>
On 10. 11. 26, 11:54, Gu Bin wrote:
> In imx_uart_poll_init(), when clk_prepare_enable(sport->clk_per) fails
> the error branch only disables the previously enabled clk_ipg and then
> falls through: the function keeps programming the UART (imx_uart_setup_ufcr
> and the register writes below) with both clocks disabled and eventually
> returns 0, reporting success for a port that never came up.
>
> The sibling imx_uart_startup() handles the same situation by returning
> the error after the rollback.
>
> Return the error after rolling back clk_ipg, matching
> imx_uart_startup().
>
> Fixes: 6b8bdad96164 ("serial: imx: add imx_poll_init()")
> Signed-off-by: Gu Bin <gubin@cmss.chinamobile.com>
I am not sure this is correct at all.
Ccin the author of the code would've helped. Done now.
> ---
> drivers/tty/serial/imx.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 0831bd5ee3dc..2a931361d17c 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -1954,8 +1954,10 @@ static int imx_uart_poll_init(struct uart_port *port)
> if (retval)
> return retval;
> retval = clk_prepare_enable(sport->clk_per);
> - if (retval)
> + if (retval) {
> clk_disable_unprepare(sport->clk_ipg);
> + return retval;
> + }
>
> imx_uart_setup_ufcr(sport, TXTL_DEFAULT, sport->rxtl);
>
--
js
suse labs
next prev parent reply other threads:[~2026-11-11 9:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 10:54 Gu Bin
2026-11-11 9:21 ` Jiri Slaby [this message]
2026-11-11 9:37 ` Jiri Slaby
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=1e584df0-c74a-454f-a580-75dc7567abe1@kernel.org \
--to=jirislaby@kernel.org \
--cc=Frank.Li@nxp.com \
--cc=daniel.thompson@linaro.org \
--cc=festevam@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=gubin@cmss.chinamobile.com \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
/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 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®