All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Louis-Alexis Eyraud" <louisalexis.eyraud@collabora.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH net-next 3/6] net: stmmac: mediatek: rename MT2712 and MT8195 variant methods
Date: Wed, 08 Jul 2026 08:21:53 +0000	[thread overview]
Message-ID: <20260708082154.2D9A21F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260707-dwmac-mediatek-mt8189-v1-3-17f345eaaca3@collabora.com>

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

Pre-existing issues:
- [High] The return value of `mediatek_dwmac_init()` is ignored during driver probe, allowing the driver to silently bind to unconfigured or unsupported hardware.
- [High] Early error return in `set_delay_v2()` causes state corruption of `mac_delay` values on unsupported PHY modes.
--

--- Patch [3]: [PATCH net-next 3/6] net: stmmac: mediatek: rename MT2712 and MT8195 variant methods ---
commit e972fc035e44817992b0ce16715cf1cbcf9432c0
Author: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>

    net: stmmac: mediatek: rename MT2712 and MT8195 variant methods
    
    In preparation of newer SoC support, rename MT2712 and MT8195 variant
    methods and sub functions to more generic names.

> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
> index 0cabab4fd89a3..28e87990b0a10 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
[ ... ]
> @@ -317,13 +317,13 @@ static void mt8195_delay_stage2ps(struct mediatek_dwmac_plat_data *plat)
>  	mac_delay->rx_delay *= 290;
>  }
>  
> -static int mt8195_set_delay(struct mediatek_dwmac_plat_data *plat)
> +static int set_delay_v2(struct mediatek_dwmac_plat_data *plat)
>  {
>  	u32 gtxc_delay_val = 0, delay_val = 0, rmii_delay_val = 0;
>  	struct mac_delay_struct *mac_delay = &plat->mac_delay;
>  	u32 reg_offset = plat->variant->peri_eth_ctrl_offset;
>  
> -	mt8195_delay_ps2stage(plat);
> +	delay_ps2stage_v2(plat);
>  
>  	switch (plat->phy_mode) {
>  	case PHY_INTERFACE_MODE_MII:
> @@ -419,14 +419,14 @@ static int mt8195_set_delay(struct mediatek_dwmac_plat_data *plat)
>  		     reg_offset + MT8195_PERI_ETH_CTRL2,
>  		     rmii_delay_val);
>  
> -	mt8195_delay_stage2ps(plat);
> +	delay_stage2ps_v2(plat);

[Severity: High]
This isn't a bug introduced by this patch, but does the early return on
unsupported PHY modes in set_delay_v2() bypass this call?

If phy_mode is an unsupported mode, the switch statement falls through to the
default case which returns -EINVAL. This skips the call to
delay_stage2ps_v2() that restores the mac_delay values.

Since the values are unconditionally divided at the start of the function:

    delay_ps2stage_v2(plat);
        mac_delay->tx_delay /= 290;
        mac_delay->rx_delay /= 290;

If this happens during suspend/resume cycles, won't the delays be cumulatively
truncated to zero?

>  
>  	return 0;
>  }

[Severity: High]
This is a pre-existing issue, but is the return value of mediatek_dwmac_init()
intentionally ignored during driver probe?

Looking at mediatek_dwmac_probe() in this file:

    mediatek_dwmac_common_data(pdev, plat_dat, priv_plat);
    mediatek_dwmac_init(&pdev->dev, priv_plat);

    ret = mediatek_dwmac_clks_config(priv_plat, true);

If hardware initialization fails (for example, due to an unsupported PHY
interface returning -EINVAL), mediatek_dwmac_probe() ignores the return value
and proceeds with registration.

Could this result in the driver binding to unconfigured hardware, leaving a
phantom interface that fails to pass traffic?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260707-dwmac-mediatek-mt8189-v1-0-17f345eaaca3@collabora.com?part=3

  parent reply	other threads:[~2026-07-08  8:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-07  8:21 [PATCH net-next 0/6] net/stmmac: Add Mediatek MT8189 support Louis-Alexis Eyraud
2026-07-07  8:21 ` [PATCH net-next 1/6] dt-bindings: net: mediatek-dwmac: add support for MT8189 SoC Louis-Alexis Eyraud
2026-07-07 12:42   ` Andrew Lunn
2026-07-08 11:36     ` Louis-Alexis Eyraud
2026-07-08 14:35       ` Andrew Lunn
2026-07-10 13:01         ` Louis-Alexis Eyraud
2026-07-10 13:35           ` Andrew Lunn
2026-07-07  8:21 ` [PATCH net-next 2/6] net: stmmac: mediatek: add PERI_ETH_CTRLx register offset in platform data Louis-Alexis Eyraud
2026-07-07  8:55   ` Maxime Chevallier
2026-07-07 12:45   ` Andrew Lunn
2026-07-08 11:44     ` Louis-Alexis Eyraud
2026-07-07  8:21 ` [PATCH net-next 3/6] net: stmmac: mediatek: rename MT2712 and MT8195 variant methods Louis-Alexis Eyraud
2026-07-07  9:05   ` Maxime Chevallier
2026-07-08 12:04     ` Louis-Alexis Eyraud
2026-07-08  8:21   ` sashiko-bot [this message]
2026-07-07  8:21 ` [PATCH net-next 4/6] net: stmmac: mediatek: add support for TX clock output enable feature Louis-Alexis Eyraud
2026-07-07  8:21 ` [PATCH net-next 5/6] net: stmmac: mediatek: add support for TX deallocation adjustment feature Louis-Alexis Eyraud
2026-07-07  9:11   ` Maxime Chevallier
2026-07-08 12:28     ` Louis-Alexis Eyraud
2026-07-08  8:21   ` sashiko-bot
2026-07-07  8:21 ` [PATCH net-next 6/6] net: stmmac: mediatek: add support for MT8189 SoC Louis-Alexis Eyraud

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=20260708082154.2D9A21F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=louisalexis.eyraud@collabora.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 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.