From: sashiko-bot@kernel.org
To: "Kyle Switch" <kyle.switch@motor-comm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH net-next v18 1/6] net: dsa: motorcomm: initialize dsa_switch based on chipid
Date: Thu, 03 Dec 2026 08:40:54 +0000 [thread overview]
Message-ID: <sashiko-outbox-247369@kernel.org> (raw)
In-Reply-To: <20261202084022.3716891-2-kyle.switch@motor-comm.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] net: dsa: motorcomm: chip ID read before SMI reset in
yt92xx_register_switch()
--
commit 4dd56147d8289334bbc07f03f99e9d097c16b21b
Author: Kyle Switch <kyle.switch@motor-comm.com>
net: dsa: motorcomm: initialize dsa_switch based on chipid
This commit replaces the hardcoded dsa_switch initialization in
yt921x_mdio_probe() with a lookup table indexed by the chip's major ID
read from YT921X_CHIP_ID.
> diff --git a/drivers/net/dsa/motorcomm/chip.c b/drivers/net/dsa/motorcomm/chip.c
> index 82f364986aebd..197dadb1046a4 100644
> --- a/drivers/net/dsa/motorcomm/chip.c
> +++ b/drivers/net/dsa/motorcomm/chip.c
> @@ -2699,6 +2699,68 @@ static const struct dsa_switch_ops yt921x_dsa_switch_ops = {
[ ... ]
> +static int yt92xx_register_switch(struct dsa_switch *ds)
> +{
> + struct yt921x_priv *priv = dsa_to_yt921x_priv(ds);
> + struct device *dev = yt921x_priv_to_device(priv);
> + const struct yt92xx_series *series;
> + u32 chipid;
> + u32 major;
> + int res;
> +
> + mutex_lock(&priv->reg_lock);
> + res = yt921x_reg_read(priv, YT921X_CHIP_ID, &chipid);
> + mutex_unlock(&priv->reg_lock);
> + if (res) {
> + dev_err(dev, "Failed to read Chip ID with errcode: %d\n", res);
> + return res;
> + }
> +
> + major = FIELD_GET(YT921X_CHIP_ID_MAJOR, chipid);
> + series = yt92xx_series_lookup(major);
> + if (!series) {
> + dev_err(dev, "Unknown Chip ID: 0x%x, or unknown Major: 0x%x\n",
> + chipid, major);
> + return -ENODEV;
> + }
[Severity: Medium]
Does reading YT921X_CHIP_ID here before yt921x_reg_mdio_reset() break
recovery when the 4-frame SMI slave state machine is out of phase at probe
time?
Previously, the first register access happened in yt921x_dsa_setup() ->
yt921x_chip_reset(), right after yt921x_reg_mdio_reset() realigned the SMI
state machine (added in bc686737f555 ("net: dsa: motorcomm: Resync SMI
slave before register access")). With yt92xx_register_switch() running in
yt921x_mdio_probe() before dsa_register_switch(), a misaligned SMI bus
causes yt921x_reg_read() to return the 0xdeaddead sentinel (or a stale
address), so yt92xx_series_lookup() fails with -ENODEV before
yt921x_chip_reset() is ever reached.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202084022.3716891-1-kyle.switch@motor-comm.com?part=1
next prev parent reply other threads:[~2026-12-03 8:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 8:40 [PATCH net-next v18 0/6] net: dsa: motorcomm: add support yt922x driver Kyle Switch
2026-12-02 8:40 ` [PATCH net-next v18 1/6] net: dsa: motorcomm: initialize dsa_switch based on chipid Kyle Switch
2026-12-03 8:40 ` sashiko-bot [this message]
2026-12-02 8:40 ` [PATCH net-next v18 2/6] net: dsa: motorcomm: use max_ports in series for port bounds checking Kyle Switch
2026-12-03 8:40 ` sashiko-bot
2026-12-02 8:40 ` [PATCH net-next v18 3/6] net: dsa: motorcomm: use GENMASK_U32() for mbus phy_mask Kyle Switch
2026-12-02 8:40 ` [PATCH net-next v18 4/6] dt-bindings: net: dsa: add Motorcomm YT9224 Kyle Switch
2026-12-02 22:58 ` Rob Herring (Arm)
2026-12-03 8:40 ` sashiko-bot
2026-12-02 8:40 ` [PATCH net-next v18 5/6] net: dsa: tag_yt922x: add support for Motorcomm YT922x tags Kyle Switch
2026-12-02 8:40 ` [PATCH net-next v18 6/6] net: dsa: motorcomm: Add support for Motorcomm YT922x Kyle Switch
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=sashiko-outbox-247369@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=kyle.switch@motor-comm.com \
--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