From: sashiko-bot@kernel.org
To: "Arina Kharlamova" <arina.kharlamova@mbzuai.ac.ae>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH 2/2] serial: uartlite: Undo clock and runtime PM setup on probe failure
Date: Tue, 01 Dec 2026 19:23:57 +0000 [thread overview]
Message-ID: <sashiko-outbox-244047@kernel.org> (raw)
In-Reply-To: <20261201-s2p-tty1-v1-2-731a5142143c@mbzuai.ac.ae>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] serial: uartlite: clock underflow and wrong teardown order in
ulite_remove() [1]
--
commit 836e2a7f4a7eacabfa56b7b7ef2b7ad0fda56104
Author: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
serial: uartlite: Undo clock and runtime PM setup on probe failure
This commit disables runtime PM, drops the runtime PM usage count, and
disables and unprepares the clock when ulite_assign() fails in
ulite_probe().
> diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
> index b9a14dc2f2fdf..d2dfdfde72a25 100644
> --- a/drivers/tty/serial/uartlite.c
> +++ b/drivers/tty/serial/uartlite.c
> @@ -881,6 +881,13 @@ static int ulite_probe(struct platform_device *pdev)
> pm_runtime_enable(&pdev->dev);
>
> ret = ulite_assign(&pdev->dev, id, res->start, irq, pdata);
> + if (ret) {
> + pm_runtime_disable(&pdev->dev);
> + pm_runtime_set_suspended(&pdev->dev);
> + pm_runtime_put_noidle(&pdev->dev);
> + clk_disable_unprepare(pdata->clk);
> + return ret;
> + }
>
> pm_runtime_mark_last_busy(&pdev->dev);
> pm_runtime_put_autosuspend(&pdev->dev);
[Severity: High]
This problem wasn't introduced by this patch, but can ulite_remove()
[1] underflow pdata->clk and access ULITE_CONTROL with the clock
gated?
drivers/tty/serial/uartlite.c:ulite_remove() {
struct uart_port *port = dev_get_drvdata(&pdev->dev);
struct uartlite_data *pdata = port->private_data;
clk_disable_unprepare(pdata->clk);
ulite_release(&pdev->dev);
pm_runtime_disable(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev);
pm_runtime_dont_use_autosuspend(&pdev->dev);
}
When the port is runtime-suspended at driver unbind, the
pm_runtime_get_sync() / pm_runtime_put_sync() cycle in
__device_release_driver() immediately re-suspends the device via
ulite_runtime_suspend(), which calls clk_disable(pdata->clk). Calling
clk_disable_unprepare(pdata->clk) unconditionally at the start of
ulite_remove() then disables an already disabled clock.
Disabling and unpreparing pdata->clk before ulite_release() calls
uart_remove_one_port() also leaves the AXI clock gated when
ulite_shutdown() accesses ULITE_CONTROL, and causes child serial-base
unregistration to call clk_enable() on an unprepared clock in
ulite_runtime_resume(). In addition, ulite_release() clears drvdata with
dev_set_drvdata(dev, NULL) before pm_runtime_disable() runs, so a
concurrent runtime PM callback can dereference a NULL port pointer from
dev_get_drvdata().
[1] https://sashiko.dev/#/bug/linux-f6fc2c71-7926-4155-b602-d912aee2abb8
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201-s2p-tty1-v1-0-731a5142143c@mbzuai.ac.ae?part=2
next prev parent reply other threads:[~2026-12-01 19:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 19:17 [PATCH 0/2] serial: owl, uartlite: undo clock setup on probe failure Arina Kharlamova via B4 Relay
2026-12-01 19:17 ` [PATCH 1/2] serial: owl: Disable the clock when uart_add_one_port() fails Arina Kharlamova via B4 Relay
2026-12-01 19:17 ` [PATCH 2/2] serial: uartlite: Undo clock and runtime PM setup on probe failure Arina Kharlamova via B4 Relay
2026-12-01 19:23 ` sashiko-bot [this message]
2026-12-01 19:23 ` [PATCH 0/2] serial: owl, uartlite: undo clock " 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=sashiko-outbox-244047@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=arina.kharlamova@mbzuai.ac.ae \
--cc=linux-serial@vger.kernel.org \
--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