]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: phy: dp83867: avoid error in dp83867_of_init() when PHY has no OF node
authorVladimir Oltean <vladimir.oltean@nxp.com>
Wed, 23 Feb 2022 13:20:55 +0000 (15:20 +0200)
committerRamon Fried <ramon@neureality.ai>
Sun, 10 Apr 2022 05:44:12 +0000 (08:44 +0300)
A DM_ETH driver may use phy_connect() towards a PHY address on an MDIO
bus which is not specified in the device tree, as evidenced by:

pfe_eth_probe
-> pfe_phy_configure
   -> phy_connect

When this happens, the PHY will have an invalid OF node.

The dp83867_config() method has extra initialization steps which are
bypassed when the PHY lacks an OF node, which is undesirable because it
will lead to broken networking. Allow the rest of the code to run.

Fixes: 085445ca4104 ("net: phy: ti: Allow the driver to be more configurable")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
drivers/net/phy/dp83867.c

index eada4541c9c336c786ec2d0c7d5bfe5e77edaa23..49978d0f25f3948dddf915d3f1a0927c4ed72537 100644 (file)
@@ -158,7 +158,7 @@ static int dp83867_of_init(struct phy_device *phydev)
 
        node = phy_get_ofnode(phydev);
        if (!ofnode_valid(node))
-               return -EINVAL;
+               return 0;
 
        /* Optional configuration */
        ret = ofnode_read_u32(node, "ti,clk-output-sel",