Re: [PATCH net 3/5] net: dsa: mt7530: register the GPIO controller last in setup
From: netdev-bot+sashiko
Date: Wed Nov 25 2026 - 04:27:24 EST
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] net: dsa: mt7530: mt7530_setup_gpio() still runs before
fallible setup steps
--
> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
> --- a/drivers/net/dsa/mt7530.c
> +++ b/drivers/net/dsa/mt7530.c
> @@ -2585,6 +2585,11 @@ mt7530_setup(struct dsa_switch *ds)
> }
> }
>
> + /* Flush the FDB table */
> + ret = mt7530_fdb_cmd(priv, MT7530_FDB_FLUSH, NULL);
> + if (ret < 0)
> + return ret;
> +
> #ifdef CONFIG_GPIOLIB
> if (of_property_read_bool(priv->dev->of_node, "gpio-controller")) {
> ret = mt7530_setup_gpio(priv);
[Severity: Medium]
The commit message says this makes the GPIO controller visible only
once every fallible step of setup has succeeded. However, mt7530_setup()
is only the priv->info->sw_setup() callback. After it returns 0,
mt753x_setup() still calls mt7530_setup_irq() and mt7530_setup_mdio().
Both of those can fail, and mt7530_setup_irq() can also return
-EPROBE_DEFER.
If either of them fails, the gpio_chip that mt7530_setup_gpio()
registered with devm_gpiochip_add_data() on priv->dev stays published.
Once the next patch disables core_pwr and io_pwr on the failure path,
consumers would be left poking MT7530_LED_GPIO_* registers on an
unpowered switch. That is the situation this patch says it prevents.
The same applies to teardown. The chip is tied to devres on priv->dev,
not to the DSA setup/teardown cycle. Consider a multi-switch tree where
a sibling switch fails or defers. mt753x_teardown() then disables the
regulators without unbinding priv->dev, so the chip remains registered.
The next dsa_tree_setup() attempt would run mt7530_setup_gpio() again
and add a second controller.
Should the GPIO registration move to the end of mt753x_setup(), after
mt7530_setup_mdio(), with an explicit gpiochip_remove() in the error
path and in mt753x_teardown()? Or would you rather register it from
probe instead? Either way, the commit message should not claim it is
the last fallible step as things stand.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/179550875789.4156.361477684651496992%40mail.zgclab.edu.cn