From: sashiko-bot@kernel.org
To: "Maurizio Casciano" <mauriziocasciano7@gmail.com>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH v6] Input: drv260x: Fix suspend and resume sequencing
Date: Mon, 31 Aug 2026 08:28:19 +0000 [thread overview]
Message-ID: <20260831082820.063D81F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260831081227.1794986-1-mauriziocasciano7@gmail.com>
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
New issues:
- [High] The `work_disabled` flag becomes permanently wedged to `true` if the device is closed after a system resume failure, breaking force-feedback functionality on subsequent opens.
- [Low] Direct return of error code from regmap_bulk_write in a function with multiple failure points.
Pre-existing issues:
- [High] Device configuration is permanently lost if system power is cut during suspend while the input device is closed, leading to hardware misconfiguration upon the next open.
- [High] Uncancelled work item leads to Use-After-Free during device unbind due to asynchronous ff-memless timer.
--
commit 0cbbdf5958f6ed62525dabc219437a115afe42b3
Author: Maurizio Casciano <mauriziocasciano7@gmail.com>
Input: drv260x: Fix suspend and resume sequencing
Force-feedback playback is queued asynchronously, but system suspend can
cut power while the worker is pending. Disable and drain the work item
before entering standby, and keep force-feedback quiesced until resume has
restored communication.
Link: https://lore.kernel.org/linux-input/20260831011526.24AB11F000E9@smtp.kernel.org/
Link: https://lore.kernel.org/linux-input/20260830143050.03E081F000E9@smtp.kernel.org/
Link: https://lore.kernel.org/linux-input/20260829230740.126461F000E9@smtp.kernel.org/
Link: https://lore.kernel.org/linux-input/apLD91vzHIrLOPWC@google.com/
Link: https://www.ti.com/lit/ds/symlink/drv2604.pdf
> diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c
> --- a/drivers/input/misc/drv260x.c
> +++ b/drivers/input/misc/drv260x.c
[ ... ]
> @@ -258,11 +282,29 @@ static int drv260x_haptics_play(struct input_dev *input, void *data,
> return 0;
> }
>
> +static int drv260x_open(struct input_dev *input)
> +{
> + struct drv260x_data *haptics = input_get_drvdata(input);
> +
> + if (haptics->work_disabled)
> + return -EIO;
> +
> + gpiod_set_value(haptics->enable_gpio, 1);
> + /* Data sheet says to wait 250us before trying to communicate */
> + fsleep(250);
> +
> + return 0;
> +}
[Severity: High]
This is a pre-existing issue, but will device configuration be permanently
lost if system power is cut during suspend while the input device is closed?
During system suspend, VDD power can be cut. Because drv260x_resume() checks
input_device_enabled(), it skips drv260x_init() if the device was closed.
When userspace later opens the device, drv260x_open() asserts the enable
GPIO but does not reinitialize the hardware registers, leaving the device
in an erratic default state.
> static void drv260x_close(struct input_dev *input)
> {
> struct drv260x_data *haptics = input_get_drvdata(input);
> int error;
>
> + /* PM has not restored register access yet. */
> + if (haptics->work_disabled)
> + return;
[Severity: High]
Could this early return leave the device permanently wedged if it is closed
after a system resume failure?
If drv260x_resume() fails, it leaves work_disabled = true. If userspace
then closes the device, this early return skips clearing the wedge state. On
the next suspend/resume cycle, drv260x_resume() skips recovery entirely
because input_device_enabled() evaluates to false (since users is 0). The
work_disabled flag would remain stuck to true, returning -EIO on all future
opens.
>
> cancel_work_sync(&haptics->work);
[Severity: High]
This is a pre-existing issue, but does relying on close() for cancellation
risk a use-after-free during device unbind?
When the device is unbound, input_unregister_device() calls drv260x_close()
and then stops the background ff-memless timer. If the asynchronous timer
fires in that window, it can reschedule the work item after
cancel_work_sync() has already returned. Because the work item lacks a
registered devm cleanup action, it remains pending and could execute after
the memory has been freed.
[ ... ]
> @@ -398,6 +440,11 @@ static int drv260x_init(struct drv260x_data *haptics)
> return 0;
> }
>
> + if (haptics->calibration_valid)
> + return regmap_bulk_write(haptics->regmap, DRV260X_CAL_COMP,
> + haptics->calibration_data,
> + ARRAY_SIZE(haptics->calibration_data));
> +
[Severity: Low]
Does returning the error code from regmap_bulk_write() directly violate the
explicit failure paths coding style?
The input subsystem maintainer guidelines prefer the expanded error checking
form instead of returning the action directly in functions with multiple
failure points.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260831081227.1794986-1-mauriziocasciano7@gmail.com?part=1
next prev parent reply other threads:[~2026-08-31 8:28 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 23:16 [PATCH v2 0/2] Input: drv260x: restore configuration across power loss Maurizio Casciano
2026-08-27 23:16 ` [PATCH v2 1/2] Input: drv260x: Restore configuration after device close Maurizio Casciano
2026-08-27 23:30 ` sashiko-bot
2026-08-29 11:33 ` Dmitry Torokhov
2026-08-29 22:50 ` Maurizio Casciano
2026-08-27 23:16 ` [PATCH v2 2/2] Input: drv260x: Fix suspend and resume sequencing Maurizio Casciano
2026-08-29 12:14 ` Dmitry Torokhov
2026-08-29 22:57 ` [PATCH v3] " Maurizio Casciano
2026-08-29 23:07 ` sashiko-bot
2026-08-30 14:17 ` [PATCH v4] " Maurizio Casciano
2026-08-30 14:30 ` sashiko-bot
2026-08-31 1:00 ` [PATCH v5] " Maurizio Casciano
2026-08-31 1:15 ` sashiko-bot
2026-08-31 8:12 ` [PATCH v6] " Maurizio Casciano
2026-08-31 8:28 ` sashiko-bot [this message]
2026-08-31 15:03 ` [PATCH v7] " Maurizio Casciano
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=20260831082820.063D81F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=mauriziocasciano7@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.