From: sashiko-bot@kernel.org
To: "Roman Vivchar" <rva333@protonmail.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 3/3] soc: mediatek: pwrap: add mt6572 support
Date: Tue, 14 Jul 2026 13:24:18 +0000 [thread overview]
Message-ID: <20260714132418.AB7C71F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260714-6572-pwrap-v1-3-d8e5a39cf7ef@protonmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Unconditional dereference and access of `wrp->slave->dew_regs` in MT6572 clock initialization can cause a NULL pointer dereference or unintended PMIC register overwrite.
--
--- Patch [3]: [PATCH 3/3] soc: mediatek: pwrap: add mt6572 support ---
commit 27b1606815262a3356b161758ca5a4ebb413b4ab
Author: Roman Vivchar <rva333@protonmail.com>
soc: mediatek: pwrap: add mt6572 support
This commit adds mt6572 registers and platform data for the pmic wrapper.
It reuses the mt2701 SoC-specific initialization function since they share
the same GPS_INTF settings.
> diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
> index a4b10b0a97cbb..4b8a5dc80a36e 100644
> --- a/drivers/soc/mediatek/mtk-pmic-wrap.c
> +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
[ ... ]
> @@ -1733,6 +1824,11 @@ static void pwrap_init_chip_select_ext(struct pmic_wrapper *wrp, u8 hext_write,
> static int pwrap_common_init_reg_clock(struct pmic_wrapper *wrp)
> {
> switch (wrp->master->type) {
> + case PWRAP_MT6572:
> + pwrap_writel(wrp, 0x8, PWRAP_RDDMY);
> + pwrap_write(wrp, wrp->slave->dew_regs[PWRAP_DEW_RDDMY_NO], 0x8);
[Severity: High]
Could this unconditionally dereference wrp->slave->dew_regs if the configured
slave PMIC doesn't populate it?
If the mediatek,mt6572-pwrap device node is configured with a PMIC that
doesn't populate dew_regs (like PMIC_MT6380), or leaves PWRAP_DEW_RDDMY_NO
uninitialized (like PMIC_MT6397), this array lookup could either
dereference a NULL pointer or evaluate to 0x0.
This could lead to a kernel panic during driver probe or an unintended
SPI write of 0x8 to PMIC register 0x0.
Would it be safer to validate the slave PMIC type or check that dew_regs is
present before accessing it here, similar to how it is handled for
PWRAP_MT6795 below?
> + pwrap_init_chip_select_ext(wrp, 5, 0, 0, 0);
> + break;
> case PWRAP_MT6795:
> if (wrp->slave->type == PMIC_MT6331) {
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260714-6572-pwrap-v1-0-d8e5a39cf7ef@protonmail.com?part=3
prev parent reply other threads:[~2026-07-14 13:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 12:42 [PATCH 0/3] soc: mediatek: pwrap: mt6572 support + log level fixes Roman Vivchar via B4 Relay
2026-07-14 12:42 ` [PATCH 1/3] dt-bindings: soc: mediatek: pwrap: add mt6572 Roman Vivchar via B4 Relay
2026-07-14 12:42 ` [PATCH 2/3] soc: mediatek: pwrap: use correct log level Roman Vivchar via B4 Relay
2026-07-14 12:53 ` sashiko-bot
2026-07-14 12:42 ` [PATCH 3/3] soc: mediatek: pwrap: add mt6572 support Roman Vivchar via B4 Relay
2026-07-14 13:24 ` 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=20260714132418.AB7C71F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=rva333@protonmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox