Skip to content

Commit 7bd0cef

Browse files
Saravana Kannandavem330
authored andcommitted
net: mdio-mux: Handle -EPROBE_DEFER correctly
When registering mdiobus children, if we get an -EPROBE_DEFER, we shouldn't ignore it and continue registering the rest of the mdiobus children. This would permanently prevent the deferring child mdiobus from working instead of reattempting it in the future. So, if a child mdiobus needs to be reattempted in the future, defer the entire mdio-mux initialization. This fixes the issue where PHYs sitting under the mdio-mux aren't initialized correctly if the PHY's interrupt controller is not yet ready when the mdio-mux is being probed. Additional context in the link below. Fixes: 0ca2997 ("netdev/of/phy: Add MDIO bus multiplexer support.") Link: https://lore.kernel.org/lkml/CAGETcx95kHrv8wA-O+-JtfH7H9biJEGJtijuPVN0V5dUKUAB3A@mail.gmail.com/#t Signed-off-by: Saravana Kannan <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Acked-by: Marc Zyngier <[email protected]> Tested-by: Marc Zyngier <[email protected]> Acked-by: Kevin Hilman <[email protected]> Tested-by: Kevin Hilman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 99d81e9 commit 7bd0cef

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/net/mdio/mdio-mux.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,15 @@ int mdio_mux_init(struct device *dev,
175175
cb->mii_bus->write = mdio_mux_write;
176176
r = of_mdiobus_register(cb->mii_bus, child_bus_node);
177177
if (r) {
178+
mdiobus_free(cb->mii_bus);
179+
if (r == -EPROBE_DEFER) {
180+
ret_val = r;
181+
goto err_loop;
182+
}
183+
devm_kfree(dev, cb);
178184
dev_err(dev,
179185
"Error: Failed to register MDIO bus for child %pOF\n",
180186
child_bus_node);
181-
mdiobus_free(cb->mii_bus);
182-
devm_kfree(dev, cb);
183187
} else {
184188
cb->next = pb->children;
185189
pb->children = cb;

0 commit comments

Comments
 (0)