From: sashiko-bot@kernel.org
To: "Markus Probst" <markus.probst@posteo.de>
Cc: linux-serial@vger.kernel.org, ojeda@kernel.org, gary@garyguo.net
Subject: Re: [PATCH v4 1/4] tty: serdev: Add mutex lock
Date: Fri, 16 Oct 2026 18:15:20 +0000 [thread overview]
Message-ID: <sashiko-outbox-174757@kernel.org> (raw)
In-Reply-To: <20261016-rust_serdev_probe_refactor-v4-1-46832e034757@posteo.de>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] pm: async pm_runtime_put() in remove path cancelled by pm_runtime_disable()
--
commit c4731a25fb19c22b675757b565d963b9ad0190e8
Author: Markus Probst <markus.probst@posteo.de>
tty: serdev: Add mutex lock
Besides more predictable behaviour, this allows for several hardened
behaviour changes. If the device is left open by the driver after remove,
close it and warn instead of leaving it in an invalid state.
> diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
> index 7500efcdfc218..77e8e1d4d2a66 100644
> --- a/drivers/tty/serdev/core.c
> +++ b/drivers/tty/serdev/core.c
> @@ -142,6 +142,11 @@ void serdev_device_remove(struct serdev_device *serdev)
> struct serdev_controller *ctrl = serdev->ctrl;
>
> device_unregister(&serdev->dev);
> +
> + /* Warn if driver did not close the serial device. */
> + if (ctrl->ops->close && WARN_ON(ctrl->ops->close(ctrl)))
> + pm_runtime_put(&ctrl->dev);
[Severity: Medium]
When this path is reached during controller teardown, will the pending
asynchronous suspend work be cancelled?
In serdev_controller_remove(), device_for_each_child() synchronously invokes
the removal, and then immediately calls pm_runtime_disable(&ctrl->dev):
serdev_controller_remove() {
...
device_for_each_child(&ctrl->dev, NULL, serdev_remove_device);
pm_runtime_disable(&ctrl->dev);
device_del(&ctrl->dev);
}
Since pm_runtime_disable() cancels pending asynchronous idle and suspend work,
calling pm_runtime_put() here instead of pm_runtime_put_sync() can prevent the
hardware from actually suspending, leaving the controller powered on indefinitely.
Could pm_runtime_put_sync() be used here instead to ensure the device is
properly suspended before pm_runtime_disable() is called?
> +
> ctrl->serdev = NULL;
> }
> EXPORT_SYMBOL_GPL(serdev_device_remove);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261016-rust_serdev_probe_refactor-v4-0-46832e034757@posteo.de?part=1
next prev parent reply other threads:[~2026-10-16 18:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 18:00 [PATCH v4 0/4] rust: serdev: Refactor Markus Probst
2026-10-16 18:00 ` [PATCH v4 1/4] tty: serdev: Add mutex lock Markus Probst
2026-10-16 18:15 ` sashiko-bot [this message]
2026-10-16 18:00 ` [PATCH v4 2/4] tty: serdev: Export functions to pause receive_buf callback calls Markus Probst
2026-10-16 18:13 ` sashiko-bot
2026-10-16 18:00 ` [PATCH v4 3/4] rust: serdev: Replace `active` mutex with receive pause Markus Probst
2026-10-16 18:11 ` sashiko-bot
2026-10-16 18:00 ` [PATCH v4 4/4] rust: serdev: Simplify callbacks Markus Probst
2026-10-16 18:17 ` 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-174757@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=gary@garyguo.net \
--cc=linux-serial@vger.kernel.org \
--cc=markus.probst@posteo.de \
--cc=ojeda@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