From: sashiko-bot@kernel.org
To: phucduc.bui@gmail.com
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH v2 2/2] Input: st-keyscan: Improve probe error handling
Date: Mon, 27 Jul 2026 10:20:16 +0000 [thread overview]
Message-ID: <20260727102017.4AE231F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260727101125.28291-2-phucduc.bui@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Hardware access with disabled clock in ISR causes bus faults (spurious or pending interrupts)
--
--- Patch [2]: [PATCH v2 2/2] Input: st-keyscan: Improve probe error handling ---
commit 006b58b79139d033aaee4496bf01651147f36cad
Author: bui duc phuc <phucduc.bui@gmail.com>
Input: st-keyscan: Improve probe error handling
This commit updates probe error handling by using dev_err_probe() for
devm_clk_get(), dropping a redundant error message after devm_request_irq(),
and returning the original error code from platform_get_irq().
> diff --git a/drivers/input/keyboard/st-keyscan.c b/drivers/input/keyboard/st-keyscan.c
> --- a/drivers/input/keyboard/st-keyscan.c
> +++ b/drivers/input/keyboard/st-keyscan.c
[ ... ]
> @@ -188,14 +187,12 @@ static int keyscan_probe(struct platform_device *pdev)
>
> keypad_data->irq = platform_get_irq(pdev, 0);
> if (keypad_data->irq < 0)
> - return -EINVAL;
> + return keypad_data->irq;
>
> error = devm_request_irq(&pdev->dev, keypad_data->irq, keyscan_isr, 0,
> pdev->name, keypad_data);
> - if (error) {
> - dev_err(&pdev->dev, "failed to request IRQ\n");
> + if (error)
> return error;
[Severity: High]
This isn't a bug introduced by this patch, but I noticed a pre-existing issue
with how the interrupt is registered here.
Since keyscan_stop() is called just before this in keyscan_probe(), the IP
block's clock is already gated. By requesting the interrupt without
IRQF_NO_AUTOEN, the interrupt is immediately unmasked at the interrupt
controller.
If a pending or spurious interrupt fires before the device is opened, could
the ISR attempt to access hardware registers while the clock is disabled?
drivers/input/keyboard/st-keyscan.c:keyscan_isr() {
...
state = readl(keypad->base + KEYSCAN_MATRIX_STATE_OFF) & 0xffff;
...
}
Does this sequence risk a synchronous external abort (bus fault) causing a
kernel panic on this platform?
Would it be safer to request the IRQ with IRQF_NO_AUTOEN so it remains masked
until keyscan_open() explicitly enables the clock? I noticed this same window
might exist in keyscan_close(), which disables the clock via keyscan_stop()
but leaves the IRQ unmasked.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260727101125.28291-1-phucduc.bui@gmail.com?part=2
next prev parent reply other threads:[~2026-07-27 10:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-27 10:11 [PATCH v2 1/2] Input: snvs_pwrkey: Improve probe error handling phucduc.bui
2026-07-27 10:11 ` [PATCH v2 2/2] Input: st-keyscan: " phucduc.bui
2026-07-27 10:20 ` sashiko-bot [this message]
2026-07-27 10:22 ` [PATCH v2 1/2] Input: snvs_pwrkey: " sashiko-bot
-- strict thread matches above, loose matches on Subject: below --
2026-07-20 9:08 phucduc.bui
2026-07-20 9:08 ` [PATCH v2 2/2] Input: st-keyscan: " phucduc.bui
2026-07-20 9:17 ` sashiko-bot
2026-07-20 17:08 ` Dmitry Torokhov
2026-07-21 2:20 ` Bui Duc Phuc
2026-07-21 2:41 ` Bui Duc Phuc
2026-07-25 1:48 ` Dmitry Torokhov
2026-07-27 6:43 ` Bui Duc Phuc
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=20260727102017.4AE231F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=phucduc.bui@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.