net: dp83869: Reset return variable if PHY strap is read
authorDan Murphy <dmurphy@ti.com>
Fri, 5 Jun 2020 20:51:03 +0000 (15:51 -0500)
committerDavid S. Miller <davem@davemloft.net>
Sat, 6 Jun 2020 22:53:44 +0000 (15:53 -0700)
When the PHY's strap register is read to determine if lane swapping is
needed the phy_read_mmd returns the value back into the ret variable.

If the call to read the strap fails the failed value is returned.  If
the call to read the strap is successful then ret is possibly set to a
non-zero positive number. Without reseting the ret value to 0 this will
cause the parse DT function to return a failure.

Fixes: c4566aec6e808 ("net: phy: dp83869: Update port-mirroring to read straps")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/dp83869.c

index df85ae5b79e4f311366f07b456db330aa7efb260..53ed3abc26c90cd549250b520adb1d07cee14cb6 100644 (file)
@@ -218,10 +218,13 @@ static int dp83869_of_init(struct phy_device *phydev)
                ret = phy_read_mmd(phydev, DP83869_DEVADDR, DP83869_STRAP_STS1);
                if (ret < 0)
                        return ret;
+
                if (ret & DP83869_STRAP_MIRROR_ENABLED)
                        dp83869->port_mirroring = DP83869_PORT_MIRRORING_EN;
                else
                        dp83869->port_mirroring = DP83869_PORT_MIRRORING_DIS;
+
+               ret = 0;
        }
 
        if (of_property_read_u32(of_node, "rx-fifo-depth",