Re: [PATCH net-next v4 4/4] net: mdio: reset PHY before attempting to access registers in fwnode_mdiobus_register_phy
From: Jakub Kicinski
Date: Tue Oct 28 2025 - 21:26:07 EST
On Wed, 22 Oct 2025 11:08:53 +0200 Buday Csaba wrote:
> +/* Hard-reset a PHY before registration */
> +static int fwnode_reset_phy(struct mii_bus *bus, u32 addr,
> + struct fwnode_handle *phy_node)
> +{
> + struct mdio_device *tmpdev;
> + int err;
> +
> + tmpdev = mdio_device_create(bus, addr);
> + if (IS_ERR(tmpdev))
> + return PTR_ERR(tmpdev);
> +
> + fwnode_handle_get(phy_node);
> + device_set_node(&tmpdev->dev, phy_node);
> + err = mdio_device_register_reset(tmpdev);
> + if (err) {
> + mdio_device_free(tmpdev);
> + return err;
Should we worry about -EPROBE_DEFER on any of the error paths here?
If not maybe consider making this function void? We can add errors
back if the caller starts to care.
> + }
> +
> + if (mdio_device_has_reset(tmpdev)) {
> + dev_info(&bus->dev,
> + "PHY device at address %d not detected, resetting PHY.",
> + addr);
IDK if this is still strictly necessary but I guess \n at the end of
the info msg would be idiomatic