Skip to content

Commit

Permalink
net: lan966x: check devm_of_phy_get() for -EDEFER_PROBE
Browse files Browse the repository at this point in the history
At the moment, if devm_of_phy_get() returns an error the serdes
simply isn't set. While it is bad to ignore an error in general, there
is a particular bug that network isn't working if the serdes driver is
compiled as a module. In that case, devm_of_phy_get() returns
-EDEFER_PROBE and the error is silently ignored.

The serdes is optional, it is not there if the port is using RGMII, in
which case devm_of_phy_get() returns -ENODEV. Rearrange the error
handling so that -ENODEV will be handled but other error codes will
abort the probing.

Fixes: d28d6d2 ("net: lan966x: add port module support")
Signed-off-by: Michael Walle <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
mwalle authored and kuba-moo committed May 27, 2022
1 parent 4548ad7 commit b58cdd4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/net/ethernet/microchip/lan966x/lan966x_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1120,8 +1120,13 @@ static int lan966x_probe(struct platform_device *pdev)
lan966x->ports[p]->fwnode = fwnode_handle_get(portnp);

serdes = devm_of_phy_get(lan966x->dev, to_of_node(portnp), NULL);
if (!IS_ERR(serdes))
lan966x->ports[p]->serdes = serdes;
if (PTR_ERR(serdes) == -ENODEV)
serdes = NULL;
if (IS_ERR(serdes)) {
err = PTR_ERR(serdes);
goto cleanup_ports;
}
lan966x->ports[p]->serdes = serdes;

lan966x_port_init(lan966x->ports[p]);
}
Expand Down

0 comments on commit b58cdd4

Please sign in to comment.