From: sashiko-bot@kernel.org
To: "Congcong Yao" <congcong.yao@mediatek.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH RESEND 1/2] memory: mtk-smi: Add mt8189 support
Date: Wed, 22 Jul 2026 09:40:57 +0000 [thread overview]
Message-ID: <20260722094057.E47B51F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260722-8189-smi-support-v1-1-b528a4fd878c@mediatek.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The newly added OSTD array for MT8189 contains 0x0 values in the middle of port configuration lists, which will cause the initialization loop to prematurely terminate and skip remaining ports.
- [High] The `mtk_smi_larb_mt8189_ostd` array is incorrectly indexed using physical LARB IDs instead of the logical `larbid`s, leading to uninitialized (zero) configuration values being used for sparse LARBs.
--
--- Patch [1]: [PATCH RESEND 1/2] memory: mtk-smi: Add mt8189 support ---
commit a0aeb95996d513c82894f215895c9e39ee05a1de
Author: Congcong Yao <congcong.yao@mediatek.com>
memory: mtk-smi: Add mt8189 support
Add the necessary platform data and ostdl setting to enable support
for mt8189 smi.
> diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
> index aaeba8ab211e9..f2d5462af6817 100644
> --- a/drivers/memory/mtk-smi.c
> +++ b/drivers/memory/mtk-smi.c
> @@ -401,6 +401,30 @@ static const u8 mtk_smi_larb_mt8188_ostd[][SMI_LARB_PORT_NR_MAX] = {
> [25] = {0x01},
> };
>
> +static const u8 mtk_smi_larb_mt8189_ostd[][SMI_LARB_PORT_NR_MAX] = {
> + [0] = {0x8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x10, 0x0,},
> + [1] = {0x8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x10, 0x0,},
> + [2] = {0x7, 0x7, 0x4, 0x4, 0x0, 0x0, 0x2, 0x2, 0x7, 0x7, 0x0,},
[Severity: High]
Does this explicit 0x0 value cause the initialization loop to prematurely
terminate?
During MT8189 SMI LARB initialization, mtk_smi_larb_config_port_gen2_general()
iterates over the OSTD configurations. The loop uses !!larbostd[i] as a
termination condition:
for (i = 0; i < SMI_LARB_PORT_NR_MAX && larbostd && !!larbostd[i]; i++) {
...
}
Because mtk_smi_larb_mt8189_ostd[2] explicitly specifies 0x0 for ports 4 and 5,
the loop will break at port 4, completely skipping the configuration of ports
6 through 9.
> + [4] = {0x2F, 0x1E, 0x9, 0x1, 0x1, 0x1, 0x1, 0x2, 0x2, 0x5, 0x1, 0x17,},
[Severity: High]
Are these indices using physical LARB IDs instead of logical contiguous IDs?
The SMI device tree bindings map sparse physical LARBs to contiguous logical
IDs. The SMI driver populates larb->larbid directly from this logical ID via
the mediatek,larb-id DT property.
If this array uses physical IDs (e.g., [4], [7], [20]), then when probing a
sparse LARB like LARB 4, the driver accesses larb_gen->ostd[3] (its logical
ID), which is empty. This would lead to uninitialized zero configuration values
being used for all sparse LARBs.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260722-8189-smi-support-v1-0-b528a4fd878c@mediatek.com?part=1
next prev parent reply other threads:[~2026-07-22 9:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 9:21 [PATCH RESEND 0/2] memory: mtk-smi: add MT8189 SMI support Congcong Yao via B4 Relay
2026-07-22 9:21 ` Congcong Yao
2026-07-22 9:21 ` [PATCH RESEND 1/2] memory: mtk-smi: Add mt8189 support Congcong Yao via B4 Relay
2026-07-22 9:21 ` Congcong Yao
2026-07-22 9:40 ` sashiko-bot [this message]
2026-07-22 9:21 ` [PATCH RESEND 2/2] dt-bindings: memory-controllers: mtk-smi: Add support for mt8189 Congcong Yao via B4 Relay
2026-07-22 9:21 ` Congcong Yao
2026-07-22 9:34 ` 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=20260722094057.E47B51F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=congcong.yao@mediatek.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@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 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.