Skip to content

Commit

Permalink
net: phylink: propagate phy_attach_direct() return code
Browse files Browse the repository at this point in the history
of_phy_attach() hides the return value of phy_attach_direct(), forcing
us to return a "generic" ENODEV error code that is indistinguishable
from the lack-of-phy-property case.

Switch to using of_phy_find_device() to find the PHY device, and then
propagating any phy_attach_direct() error back to the caller.

Link: https://lore.kernel.org/lkml/20191210113829.GT25745@shell.armlinux.org.uk
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
  • Loading branch information
Russell King authored and Jakub Kicinski committed Dec 15, 2019
1 parent de17996 commit f5058a2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/net/phy/phylink.c
Original file line number Diff line number Diff line change
Expand Up @@ -860,14 +860,17 @@ int phylink_of_phy_connect(struct phylink *pl, struct device_node *dn,
return 0;
}

phy_dev = of_phy_attach(pl->netdev, phy_node, flags,
pl->link_interface);
phy_dev = of_phy_find_device(phy_node);
/* We're done with the phy_node handle */
of_node_put(phy_node);

if (!phy_dev)
return -ENODEV;

ret = phy_attach_direct(pl->netdev, phy_dev, flags,
pl->link_interface);
if (ret)
return ret;

ret = phylink_bringup_phy(pl, phy_dev, pl->link_config.interface);
if (ret)
phy_detach(phy_dev);
Expand Down

0 comments on commit f5058a2

Please sign in to comment.