Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Luca Leonardo Scorcia" <l.scorcia@gmail.com>
Cc: linux-input@vger.kernel.org, mfd@lists.linux.dev,
	conor+dt@kernel.org, robh@kernel.org, lee@kernel.org,
	devicetree@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v10 2/9] dt-bindings: input: mtk-pmic-keys: Add MT6392 PMIC keys
Date: Wed, 02 Sep 2026 19:50:53 +0000	[thread overview]
Message-ID: <20260902195053.AC0471F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260902193351.185771-3-l.scorcia@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Driver blindly assumes DT child node ordering corresponds to specific physical keys (Power vs Home).
--

commit 60da1299ae1ca5678f1be4e16da6d490bbacc023
Author: Fabien Parent <parent.f@gmail.com>
dt-bindings: input: mtk-pmic-keys: Add MT6392 PMIC keys

This commit adds the binding documentation for the MT6392 PMIC keys to the
mediatek,pmic-keys device tree binding schema.

> diff --git a/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml b/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml
> index 140a862ecfbeb..ff720588128be 100644
> --- a/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml
> +++ b/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml
> @@ -31,6 +31,7 @@ properties:
>            - mediatek,mt6357-keys
>            - mediatek,mt6358-keys
>            - mediatek,mt6359-keys
> +          - mediatek,mt6392-keys
>            - mediatek,mt6397-keys

[Severity: High]
This isn't a bug introduced by this patch, but while reviewing the bindings
for these PMIC keys, I noticed a pre-existing issue in the corresponding
driver implementation that consumes these device tree nodes.

Does the driver blindly assume device tree child node ordering corresponds to
specific physical keys?

Looking at mtk_pmic_keys_probe() in drivers/input/keyboard/mtk-pmic-keys.c:

	for_each_child_of_node_scoped(node, child) {
		keys->keys[index].regs = &mtk_pmic_regs->keys_regs[index];

		keys->keys[index].irq =
			platform_get_irq_byname(pdev, irqnames[index]);
        ...

Because for_each_child_of_node_scoped() yields child nodes in an undefined
order, could this sequential assignment swap the physical Power and Home keys
(index 0 vs index 1) if a device tree author defines the home node before the
power node, or if an external bootloader/overlay reorders them?

Since the device tree is a strict ABI, relying on undefined node ordering
might lead to functionally broken hardware (such as the physical power button
acting as the home button). Would it make sense to explicitly check the child
node name or use a specific property to identify which node corresponds to
which key instead of relying on the iteration index?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260902193351.185771-1-l.scorcia@gmail.com?part=2

  reply	other threads:[~2026-09-02 19:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02 19:25 [PATCH v10 0/9] Add support for MT6392 PMIC Luca Leonardo Scorcia
2026-09-02 19:25 ` [PATCH v10 1/9] dt-bindings: mfd: mt6397: Add " Luca Leonardo Scorcia
2026-09-02 19:41   ` sashiko-bot
2026-09-03  8:24   ` Krzysztof Kozlowski
2026-09-02 19:25 ` [PATCH v10 2/9] dt-bindings: input: mtk-pmic-keys: Add MT6392 PMIC keys Luca Leonardo Scorcia
2026-09-02 19:50   ` sashiko-bot [this message]
2026-09-02 19:25 ` [PATCH v10 3/9] regulator: dt-bindings: Add MediaTek MT6392 PMIC Luca Leonardo Scorcia
2026-09-02 20:00   ` sashiko-bot
2026-09-02 19:25 ` [PATCH v10 4/9] mfd: mt6397: Use MFD_CELL_* to describe sub-devices Luca Leonardo Scorcia
2026-09-02 20:10   ` sashiko-bot
2026-09-02 19:25 ` [PATCH v10 5/9] mfd: mt6397: Add support for MT6392 PMIC Luca Leonardo Scorcia
2026-09-02 20:24   ` sashiko-bot
2026-09-02 19:25 ` [PATCH v10 6/9] input: keyboard: mtk-pmic-keys: Add MT6392 support Luca Leonardo Scorcia
2026-09-02 20:37   ` sashiko-bot
2026-09-02 19:25 ` [PATCH v10 7/9] pinctrl: mediatek: mt6397: Add MediaTek MT6392 Luca Leonardo Scorcia
2026-09-02 20:50   ` sashiko-bot
2026-09-02 19:25 ` [PATCH v10 8/9] regulator: Add MediaTek MT6392 regulator Luca Leonardo Scorcia
2026-09-02 20:58   ` sashiko-bot
2026-09-02 19:25 ` [PATCH v10 9/9] arm64: dts: mediatek: Add MediaTek MT6392 PMIC dtsi Luca Leonardo Scorcia
2026-09-02 21:05   ` sashiko-bot

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=20260902195053.AC0471F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=l.scorcia@gmail.com \
    --cc=lee@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=mfd@lists.linux.dev \
    --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