Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Rosen Penev" <rosenp@gmail.com>
Cc: Frank.Li@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCHv2] serial: mxs-auart: fix probe error paths and clock handling
Date: Sat, 30 May 2026 20:07:32 +0000	[thread overview]
Message-ID: <20260530200732.787C81F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260530195525.5059-1-rosenp@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The unconditional `clk_disable_unprepare(s->clk)` at the end of `probe()` breaks the serial console output.
--

commit 09d89989b2eafe8aa07311d7fa3bb051e4b94c5c
Author: Rosen Penev <rosenp@gmail.com>

serial: mxs-auart: fix probe error paths and clock handling

This commit fixes probe error paths and clock handling in the mxs-auart driver.
It resolves unenabled clock accesses in probe, fixes port array bounds writes
on DT devices, and corrects out-of-order unmapping during error handling.

> diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
> index 693b491f1e755..a583a897a8f7d 100644
> --- a/drivers/tty/serial/mxs-auart.c
> +++ b/drivers/tty/serial/mxs-auart.c

[ ... ]

> @@ -1652,15 +1617,34 @@ static int mxs_auart_probe(struct platform_device *pdev)

[ ... ]

>  	/* ASM9260 don't have version reg */
>  	if (is_asm9260_auart(s)) {
> @@ -1672,20 +1656,13 @@ static int mxs_auart_probe(struct platform_device *pdev)
>  			 (version >> 16) & 0xff, version & 0xffff);
>  	}
>  
> -	return 0;
> -
> -out_free_qpio_irq:
> -	mxs_auart_free_gpio_irq(s);
> -	auart_port[pdev->id] = NULL;
> +	/* Disable clock – startup will re-enable when the port is opened */
> +	clk_disable_unprepare(s->clk);

[Severity: High]
Will this unconditional clk_disable_unprepare() break the serial console?

If the UART is configured as the console, printk() can asynchronously invoke
auart_console_write() from atomic context at any time. auart_console_write()
relies on clk_enable(s->clk) to temporarily ungate the clock.

Since the Common Clock Framework enforces that clocks must be prepared before
they are enabled, calling clk_enable() on an unprepared clock returns an
error and triggers a kernel warning. As a result, auart_console_write()
will abort and drop all console messages between the end of mxs_auart_probe()
and when userspace explicitly opens the port.

Should this check !uart_console(&s->port) before unpreparing the clock?

>  
> -out_iounmap:
> -	iounmap(s->port.membase);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260530195525.5059-1-rosenp@gmail.com?part=1

  reply	other threads:[~2026-05-30 20:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-30 19:55 [PATCHv2] serial: mxs-auart: fix probe error paths and clock handling Rosen Penev
2026-05-30 20:07 ` sashiko-bot [this message]
2026-05-31  7:51 ` Greg Kroah-Hartman
2026-05-31  8:00   ` Rosen Penev
2026-05-31  8:12     ` Greg Kroah-Hartman

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=20260530200732.787C81F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=rosenp@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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