Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider. Critical: 0 · High: 2 · Medium: 0 · 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). - [High] In smsc9420_mii_init(), the patch stores the result of mdiobus_register() in `err`. - [High] The commit message says that propagating the mdiobus_register() error, especially -EPROBE_DEFER, lets 'the driver defer correctly when… -- net: ethernet: smsc9420: propagate mdiobus_register() errors The patch changes smsc9420_mii_init() to store the return value of mdiobus_register() in err. Registration errors such as -EPROBE_DEFER are then returned instead of the default -ENXIO.
> mdiobus_register() can return -EPROBE_DEFER. Return that error instead > of converting every failure to the initial -ENXIO so the driver can > defer correctly when probed from async context.
[Severity: High] Is this description accurate for this driver? smsc9420_mii_init() is not called from smsc9420_probe(). Its only caller is smsc9420_open(), the ndo_open handler. That caller replaces any non-zero return with -ENODEV: drivers/net/ethernet/smsc/smsc9420.c:smsc9420_open() { ... result = smsc9420_mii_init(dev); if (result) { netif_warn(pd, ifup, pd->dev, "Failed to initialize Phy\n"); result = -ENODEV; goto out_free_rx_ring_3; } ... } So the propagated error is thrown away. Even if it were passed through, -EPROBE_DEFER returned from ndo_open would reach userspace as errno 517. It would not trigger a deferred probe, because deferral only applies to errors returned from a .probe callback. Also, the only -EPROBE_DEFER source in __mdiobus_register() seems to be the optional reset GPIO lookup, devm_gpiod_get_optional(&bus->dev, "reset", ...). This driver never sets a parent or fwnode on its bus. Should this change be dropped? Alternatively, the MDIO bus setup could move into smsc9420_probe(), with the commit message updated to match.
> diff --git a/drivers/net/ethernet/smsc/smsc9420.c b/drivers/net/ethernet/smsc/smsc9420.c > index 0c97211b6254e..6b563b0c7cb06 100644 > --- a/drivers/net/ethernet/smsc/smsc9420.c > +++ b/drivers/net/ethernet/smsc/smsc9420.c > @@ -1153,7 +1153,8 @@ static int smsc9420_mii_init(struct net_device *dev) > /* Mask all PHYs except ID 1 (internal) */ > pd->mii_bus->phy_mask = ~(1 << 1); > > - if (mdiobus_register(pd->mii_bus)) { > + err = mdiobus_register(pd->mii_bus); > + if (err) { > netif_warn(pd, probe, pd->dev, "Error registering mii bus\n"); > goto err_out_free_bus_2; > }
[Severity: High] When mdiobus_register() succeeds, err is now 0. Does the next failure branch still return an error? drivers/net/ethernet/smsc/smsc9420.c:smsc9420_mii_init() { ... if (smsc9420_mii_probe(dev) < 0) { netif_warn(pd, probe, pd->dev, "Error probing mii bus\n"); goto err_out_unregister_bus_3; } return 0; err_out_unregister_bus_3: mdiobus_unregister(pd->mii_bus); err_out_free_bus_2: mdiobus_free(pd->mii_bus); err_out_1: return err; } Before this patch, err was still -ENXIO at this point. Now smsc9420_mii_probe() can fail because no PHY is found at address 1, or because phy_connect() fails. In that case the bus is unregistered and freed, but smsc9420_mii_init() returns 0. smsc9420_open() then treats this as success and calls: phy_start(dev->phydev); dev->phydev is still NULL at that point, because only a successful phy_connect() in smsc9420_mii_probe() sets it. phy_start() calls mutex_lock(&phydev->lock) without a NULL check. Can this oops while RTNL is held? pd->mii_bus is also left pointing at freed memory. Later, smsc9420_stop() would hit BUG_ON(!dev->phydev). After that, it would call mdiobus_unregister() and mdiobus_free() on the bus that was already freed. Would something like this restore the previous behaviour? err = smsc9420_mii_probe(dev); if (err < 0) { netif_warn(pd, probe, pd->dev, "Error probing mii bus\n"); goto err_out_unregister_bus_3; }
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40163.com