From: sashiko-bot@kernel.org
To: "Karlos Abel" <kabel@voidship.net>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v2 1/2] Input: discard pre-registration events before attaching handlers
Date: Sat, 10 Oct 2026 19:17:06 +0000 [thread overview]
Message-ID: <sashiko-outbox-166847@kernel.org> (raw)
In-Reply-To: <20261010191033.23577-2-kabel@voidship.net>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] input: mixed goto-based error cleanup and scope-based guards
--
commit 4198890f3caadca9048a77f9b7d142bbae15ab35
Author: Karlos Abel <kabel@voidship.net>
Input: discard pre-registration events before attaching handlers
This commit prevents replaying pre-registration events when an input handler
connects. It does this by clearing the pending event count and monotonic
timestamp under event_lock before attaching handlers.
> diff --git a/drivers/input/input.c b/drivers/input/input.c
> index 01c91fec9b7eb..d59d62caa2f92 100644
> --- a/drivers/input/input.c
> +++ b/drivers/input/input.c
> @@ -2445,6 +2445,12 @@ int input_register_device(struct input_dev *dev)
>
> error = -EINTR;
> scoped_cond_guard(mutex_intr, goto err_device_del, &input_mutex) {
> + /* Keep seeded state, but do not replay pre-registration events. */
> + scoped_guard(spinlock_irq, &dev->event_lock) {
> + dev->num_vals = 0;
> + dev->timestamp[INPUT_CLK_MONO] = ktime_set(0, 0);
> + }
> +
[Severity: Low]
Does this mix scope-based cleanup with goto-based error handling?
The kernel cleanup guidelines in include/linux/cleanup.h and the subsystem
rules state that we should either convert all resources requiring a "goto"
cleanup to scope-based cleanup, or convert none of them. Mixing both in the
same function creates confusing ownership semantics and increases the risk
of double-free or resource leak bugs.
Because input_register_device() uses manual goto labels (err_device_del,
err_devres_free) for its failure paths, does adding new scope-based cleanup
macros like scoped_guard() here violate the cleanup guidelines?
> list_add_tail(&dev->node, &input_dev_list);
>
> list_for_each_entry(handler, &input_handler_list, node)
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261010191033.23577-1-kabel@voidship.net?part=1
next prev parent reply other threads:[~2026-10-10 19:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-10 19:10 [PATCH v2 0/2] Input: discard pre-registration events and test state seeding Karlos Abel
2026-10-10 19:10 ` [PATCH v2 1/2] Input: discard pre-registration events before attaching handlers Karlos Abel
2026-10-10 19:17 ` sashiko-bot [this message]
2026-10-10 19:10 ` [PATCH v2 2/2] Input: test state seeding across device registration Karlos Abel
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-166847@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=kabel@voidship.net \
--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 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.