sfp: fix non-detection of PHY
authorRussell King <rmk+kernel@armlinux.org.uk>
Fri, 15 Dec 2017 16:09:36 +0000 (16:09 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 18 Dec 2017 19:57:48 +0000 (14:57 -0500)
The detection of a PHY changed in commit e98a3aabf85f ("mdio_bus: don't
return NULL from mdiobus_scan()") which now causes sfp to print an
error message.  Update for this change.

Fixes: 73970055450e ("sfp: add SFP module support")
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/sfp.c

index 96511557eb2c1a3be1a9f92bc6ff94b4ba4752f2..1a958c7b912d58b889dd68689f6934ef22e79ec5 100644 (file)
@@ -356,12 +356,12 @@ static void sfp_sm_probe_phy(struct sfp *sfp)
        msleep(T_PHY_RESET_MS);
 
        phy = mdiobus_scan(sfp->i2c_mii, SFP_PHY_ADDR);
-       if (IS_ERR(phy)) {
-               dev_err(sfp->dev, "mdiobus scan returned %ld\n", PTR_ERR(phy));
+       if (phy == ERR_PTR(-ENODEV)) {
+               dev_info(sfp->dev, "no PHY detected\n");
                return;
        }
-       if (!phy) {
-               dev_info(sfp->dev, "no PHY detected\n");
+       if (IS_ERR(phy)) {
+               dev_err(sfp->dev, "mdiobus scan returned %ld\n", PTR_ERR(phy));
                return;
        }