From: sashiko-bot@kernel.org
To: "Cong Nguyen" <congnt264@gmail.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH] Input: psxpad-spi - use devm_pm_runtime_enable()
Date: Mon, 30 Nov 2026 05:04:09 +0000 [thread overview]
Message-ID: <sashiko-outbox-240382@kernel.org> (raw)
In-Reply-To: <20261130045714.654571-1-congnt264@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] Input: psxpad-spi - devm_pm_runtime_enable() called after
input_register_device()
--
commit 205ce29d7867cdc1a73d714ec01719f31658c807
Author: Cong Nguyen <congnt264@gmail.com>
Input: psxpad-spi - use devm_pm_runtime_enable()
This commit replaces pm_runtime_enable() with devm_pm_runtime_enable() in
psxpad_spi_probe() so runtime PM is disabled when the driver unbinds.
> diff --git a/drivers/input/joystick/psxpad-spi.c b/drivers/input/joystick/psxpad-spi.c
> index a2b00e420e383..3f3c2e27f0999 100644
> --- a/drivers/input/joystick/psxpad-spi.c
> +++ b/drivers/input/joystick/psxpad-spi.c
> @@ -374,7 +374,9 @@ static int psxpad_spi_probe(struct spi_device *spi)
> }
>
> spi_set_drvdata(spi, pad);
> - pm_runtime_enable(&spi->dev);
> + err = devm_pm_runtime_enable(&spi->dev);
> + if (err)
> + return err;
[Severity: Medium]
Should devm_pm_runtime_enable() and spi_set_drvdata() be called before
input_register_device()?
Because idev is allocated with devm_input_allocate_device(), calling
devm_pm_runtime_enable() after input_register_device() queues
pm_runtime_disable_action after devm_input_device_unregister in devres.
If the device is unbound while idev is open, devres disables runtime PM
on spi->dev first, and the subsequent devm_input_device_unregister() ->
psxpad_spi_poll_close() -> pm_runtime_put_sync() fails with -EACCES,
leaving spi->dev in RPM_ACTIVE and leaking an active child count on the
parent SPI controller. It also leaves a window after
input_register_device() where psxpad_spi_poll_open() can call
pm_runtime_get_sync() before runtime PM is enabled.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261130045714.654571-1-congnt264@gmail.com?part=1
prev parent reply other threads:[~2026-11-30 5:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 4:57 [PATCH] Input: psxpad-spi - use devm_pm_runtime_enable() Cong Nguyen
2026-11-30 5:04 ` sashiko-bot [this message]
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-240382@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=congnt264@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@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