From: sashiko-bot@kernel.org
To: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 04/11] ARM: s3c: crag6410: switch keypad device to software properties
Date: Thu, 09 Jul 2026 05:09:20 +0000 [thread overview]
Message-ID: <20260709050921.64F131F00A3E@smtp.kernel.org> (raw)
In-Reply-To: <20260708-samsung-kp-v2-4-3c6ed4c9b3b6@gmail.com>
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
New issues:
- [High] Legacy device tree parsing fails because matrix_keypad_parse_properties() overwrites legacy values.
- [Low] pr_err() message lacks trailing newline.
- [Low] S3C64XX_SETUP_KEYPAD Kconfig symbol is dead code but remains selected.
Pre-existing issues:
- [High] Uninitialized variables in samsung_parse_verbose_keymap() generate random keycodes and leak kernel memory.
- [High] Asynchronous data abort occurs due to IRQ registration before PM runtime enablement.
--
--- Patch [4]: [PATCH v2 04/11] ARM: s3c: crag6410: switch keypad device to software properties ---
commit acad872c671c37651ef2ad547b4a44b17438b49e
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Subject: ARM: s3c: crag6410: switch keypad device to software properties
This commit switches the keypad device to use software properties. This change
allows dropping support for platform data from the samsung-keypad driver. The
platform data and related setup code are removed from the machine
initialization.
> diff --git a/arch/arm/mach-s3c/Makefile.s3c64xx b/arch/arm/mach-s3c/Makefile.s3c64xx
> --- a/arch/arm/mach-s3c/Makefile.s3c64xx
> +++ b/arch/arm/mach-s3c/Makefile.s3c64xx
> @@ -32,7 +32,6 @@ obj-y += dev-audio-s3c64xx.o
> obj-$(CONFIG_S3C64XX_SETUP_FB_24BPP) += setup-fb-24bpp-s3c64xx.o
> obj-$(CONFIG_S3C64XX_SETUP_I2C0) += setup-i2c0-s3c64xx.o
> obj-$(CONFIG_S3C64XX_SETUP_I2C1) += setup-i2c1-s3c64xx.o
> -obj-$(CONFIG_S3C64XX_SETUP_KEYPAD) += setup-keypad-s3c64xx.o
[Severity: Low]
Is the S3C64XX_SETUP_KEYPAD Kconfig symbol dead code now?
Since the file is removed from the Makefile, the config symbol doesn't seem
to compile any code anymore, but it is still selected by MACH_WLF_CRAGG_6410
in Kconfig.s3c64xx.
[ ... ]
> diff --git a/arch/arm/mach-s3c/mach-crag6410.c b/arch/arm/mach-s3c/mach-crag6410.c
> --- a/arch/arm/mach-s3c/mach-crag6410.c
> +++ b/arch/arm/mach-s3c/mach-crag6410.c
[ ... ]
> @@ -192,17 +193,41 @@ static uint32_t crag6410_keymap[] = {
[ ... ]
> +static void __init crag6410_setup_keypad(void)
> +{
> + struct platform_device *pd;
> +
> + /* Set all the necessary GPK pins to special-function 3: KP_ROW[x] */
> + s3c_gpio_cfgrange_nopull(S3C64XX_GPK(8), 2, S3C_GPIO_SFN(3));
> +
> + /* Set all the necessary GPL pins to special-function 3: KP_COL[x] */
> + s3c_gpio_cfgrange_nopull(S3C64XX_GPL(0), 6, S3C_GPIO_SFN(3));
> +
> + pd = platform_device_register_full(&crag6410_keypad_info);
> + if (IS_ERR(pd))
> + pr_err("failed to instantiate keypad device");
[Severity: Low]
Would it be better to add a trailing newline to this pr_err() message?
It looks like the kernel log output might become garbled if the registration
fails.
> +}
[Severity: High]
Could this sequence cause a regression where legacy device trees fail to probe?
When reading properties:
drivers/input/keyboard/samsung-keypad.c:samsung_keypad_parse_properties() {
...
error = matrix_keypad_parse_properties(dev, &num_rows, &num_cols);
...
}
The matrix_keypad_parse_properties() function unconditionally zeroes the
variables at entry, so if modern properties are absent, the legacy
samsung,keypad-num-rows properties are overwritten and the function returns
-EINVAL.
[Severity: High]
This is a pre-existing issue, but might samsung_parse_verbose_keymap() leak
uninitialized stack memory to userspace?
drivers/input/keyboard/samsung-keypad.c:samsung_parse_verbose_keymap() {
...
u32 row, col, key_code;
fwnode_property_read_u32(child, "keypad,row", &row);
...
*keymap++ = KEY(row, col, key_code);
...
}
If a child node is missing the keypad,row, keypad,column, or linux,code
properties, fwnode_property_read_u32() leaves row, col, and key_code
uninitialized. These stack values are used in the KEY() macro and stored in
the keymap, where userspace can read them via the EVIOCGKEYCODE ioctl.
[Severity: High]
This is a pre-existing issue, but is it possible for an asynchronous data abort
to occur if an IRQ is pending before PM runtime is enabled?
In probe, the IRQ is requested before the device is powered on:
drivers/input/keyboard/samsung-keypad.c:samsung_keypad_probe() {
...
error = devm_request_threaded_irq(&pdev->dev, keypad->irq, NULL,
samsung_keypad_irq, IRQF_ONESHOT,
dev_name(&pdev->dev), keypad);
...
}
If an IRQ is pending from the bootloader, the handler runs immediately:
drivers/input/keyboard/samsung-keypad.c:samsung_keypad_irq() {
...
pm_runtime_get_sync(&keypad->pdev->dev);
do {
readl(keypad->base + SAMSUNG_KEYIFSTSCLR);
...
}
Since the device is unclocked and pm_runtime_get_sync() fails, readl()
accesses unclocked registers and triggers a data abort.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260708-samsung-kp-v2-0-3c6ed4c9b3b6@gmail.com?part=4
next prev parent reply other threads:[~2026-07-09 5:09 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 4:52 [PATCH v2 00/11] Remove support for platform data from samsung keypad Dmitry Torokhov
2026-07-09 4:52 ` [PATCH v2 01/11] dt-bindings: input: samsung,s3c6410-keypad: introduce compact binding Dmitry Torokhov
2026-07-09 5:05 ` sashiko-bot
2026-07-09 17:56 ` Conor Dooley
2026-07-09 4:53 ` [PATCH v2 02/11] Input: samsung-keypad - handle " Dmitry Torokhov
2026-07-09 5:06 ` sashiko-bot
2026-07-09 4:53 ` [PATCH v2 03/11] ARM: s3c: register and attach software nodes for Samsung gpio_chips Dmitry Torokhov
2026-07-09 4:53 ` [PATCH v2 04/11] ARM: s3c: crag6410: switch keypad device to software properties Dmitry Torokhov
2026-07-09 5:09 ` sashiko-bot [this message]
2026-07-09 4:53 ` [PATCH v2 05/11] Input: samsung-keypad - remove support for platform data Dmitry Torokhov
2026-07-09 5:04 ` sashiko-bot
2026-07-09 4:53 ` [PATCH v2 06/11] ARM: s3c: crag6410: use software nodes/properties to set up GPIO keys Dmitry Torokhov
2026-07-09 4:53 ` [PATCH v2 07/11] regulator: wm831x: support software node in platform data Dmitry Torokhov
2026-07-09 5:03 ` sashiko-bot
2026-07-09 4:53 ` [PATCH v2 08/11] ARM: s3c: crag6410: convert PMIC to software properties Dmitry Torokhov
2026-07-09 4:53 ` [PATCH v2 09/11] regulator: wm831x: remove legacy DVS platform data Dmitry Torokhov
2026-07-09 5:10 ` sashiko-bot
2026-07-09 4:53 ` [PATCH v2 10/11] ARM: s3c: crag6410: convert remaining GPIO lookup tables to property entries Dmitry Torokhov
2026-07-09 4:53 ` [PATCH v2 11/11] ARM: s3c: crag6410: convert basic-mmio-gpio and LEDs to software properties Dmitry Torokhov
2026-07-09 8:10 ` [PATCH v2 00/11] Remove support for platform data from samsung keypad Bartosz Golaszewski
2026-07-10 19:41 ` Linus Walleij
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=20260709050921.64F131F00A3E@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=robh@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