Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Roman Vivchar via B4 Relay" <devnull+rva333.protonmail.com@kernel.org>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 4/4] ARM: dts: mediatek: mt6323: add EFUSE support
Date: Wed, 17 Jun 2026 10:02:50 +0000	[thread overview]
Message-ID: <20260617100250.C9CEE1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260617-mt6323-nvmem-v2-4-4f30e36aa0f4@protonmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Unchecked dereference of dev->parent when getting regmap.
--

commit f140540f16666ffd0b4a44edcb3b4ac15d83d749
Author: Roman Vivchar <rva333@protonmail.com>
ARM: dts: mediatek: mt6323: add EFUSE support

This commit adds the devicetree node for the mt6323 efuse to the mt6323
PMIC definition. It introduces the mediatek,mt6323-efuse compatible string
to instantiate the driver.

> diff --git a/arch/arm/boot/dts/mediatek/mt6323.dtsi b/arch/arm/boot/dts/mediatek/mt6323.dtsi
> index c230c865116d0..807e000a7ff64 100644
> --- a/arch/arm/boot/dts/mediatek/mt6323.dtsi
> +++ b/arch/arm/boot/dts/mediatek/mt6323.dtsi
> @@ -14,6 +14,10 @@ pmic: mt6323 {
>  		interrupt-controller;
>  		#interrupt-cells = <2>;
>  
> +		efuse {
> +			compatible = "mediatek,mt6323-efuse";

[Severity: High]
Does binding to this compatible string introduce a regression under certain
devicetree configurations?

Looking at drivers/nvmem/mt6323-efuse.c:mt6323_efuse_probe(), the driver
blindly traverses the parent hierarchy:

	/* efuse -> mfd -> pwrap */
	regmap = dev_get_regmap(dev->parent->parent, NULL);

If the device is instantiated directly at the root of a Device Tree
or via a malformed overlay, it lacks a grandparent. In this case,
dev->parent is initialized to &platform_bus, and evaluating
dev->parent->parent results in a null pointer.

Passing a null pointer as the device to dev_get_regmap() triggers an
immediate kernel panic during probe(), because the underlying
devres_find() unconditionally dereferences the dev pointer.

Could the driver verify that the parent hierarchy exists before
attempting to traverse it and retrieve the regmap?

> +		};
> +

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260617-mt6323-nvmem-v2-0-4f30e36aa0f4@protonmail.com?part=4

      reply	other threads:[~2026-06-17 10:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-17  9:48 [PATCH v2 0/4] nvmem: add support for the MediaTek mt6323 PMIC Roman Vivchar via B4 Relay
2026-06-17  9:48 ` [PATCH v2 1/4] dt-bindings: mfd: mediatek: mt6397: add mt6323 PMIC EFUSE Roman Vivchar via B4 Relay
2026-06-17 10:00   ` sashiko-bot
2026-06-17  9:48 ` [PATCH v2 2/4] nvmem: add mt6323 PMIC EFUSE driver Roman Vivchar via B4 Relay
2026-06-17 10:04   ` sashiko-bot
2026-06-17  9:48 ` [PATCH v2 3/4] mfd: mt6397-core: add mt6323 EFUSE support Roman Vivchar via B4 Relay
2026-06-17  9:59   ` sashiko-bot
2026-06-17  9:48 ` [PATCH v2 4/4] ARM: dts: mediatek: mt6323: add " Roman Vivchar via B4 Relay
2026-06-17 10:02   ` sashiko-bot [this message]

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=20260617100250.C9CEE1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=devnull+rva333.protonmail.com@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