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: imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH 2/3] serial: mxs-auart: use devm resources for iomem and GPIO IRQs
Date: Wed, 03 Jun 2026 03:18:29 +0000	[thread overview]
Message-ID: <20260603031829.DF6D51F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260603025857.287148-3-rosenp@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Missing `clk_disable_unprepare()` for `s->clk` in `mxs_auart_remove()` causes a clock enable count leak.
--

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

serial: mxs-auart: use devm resources for iomem and GPIO IRQs

This commit replaces platform_get_resource and ioremap with
devm_platform_get_and_ioremap_resource. It also converts GPIO IRQ requests to
use devm_request_irq, eliminating the need for manual cleanup and simplifying
the remove function.

> diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
> --- a/drivers/tty/serial/mxs-auart.c
> +++ b/drivers/tty/serial/mxs-auart.c

[ ... ]

> @@ -1683,11 +1656,7 @@ static void mxs_auart_remove(struct platform_device *pdev)
>  	struct mxs_auart_port *s = platform_get_drvdata(pdev);
>  
>  	uart_remove_one_port(&auart_driver, &s->port);
> -	auart_port[pdev->id] = NULL;
> -	mxs_auart_free_gpio_irq(s);
> -	iounmap(s->port.membase);
> -	if (is_asm9260_auart(s))
> -		clk_disable_unprepare(s->clk);

[Severity: Medium]
Does removing clk_disable_unprepare() here cause a clock enable count leak
when the driver is unbound?

Looking at mxs_auart_probe(), the driver acquires s->clk using devm_clk_get(),
but it is explicitly prepared and enabled via clk_prepare_enable(s->clk).
Because it cannot use devm_clk_get_enabled() (its rate must be set while the
clock is disabled), its lifecycle is unmanaged.

While subsequent patches might disable the clock for non-console ports at the
end of probe(), console ports leave it enabled. Won't deleting this manual
cleanup leave the clock's prepare and enable counts unbalanced on unbind?

> +	auart_port[s->port.line] = NULL;
>  }

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

  reply	other threads:[~2026-06-03  3:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03  2:58 [PATCH 0/3] serial: mxs-auart: devm conversion, clock rework, and IRQ ordering fixes Rosen Penev
2026-06-03  2:58 ` [PATCH 1/3] serial: mxs-auart: rework clock handling in mxs_get_clks and probe Rosen Penev
2026-06-03  3:08   ` sashiko-bot
2026-06-03 18:45   ` Frank Li
2026-06-03  2:58 ` [PATCH 2/3] serial: mxs-auart: use devm resources for iomem and GPIO IRQs Rosen Penev
2026-06-03  3:18   ` sashiko-bot [this message]
2026-06-03 18:48   ` Frank Li
2026-06-03  2:58 ` [PATCH 3/3] serial: mxs-auart: fix IRQ registration ordering and manage console clock Rosen Penev
2026-06-03  3:31   ` sashiko-bot

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=20260603031829.DF6D51F00893@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