phy: Return correct error code when timeout happens
authorMichal Simek <michal.simek@xilinx.com>
Wed, 18 May 2016 10:48:57 +0000 (12:48 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 24 May 2016 11:17:59 +0000 (13:17 +0200)
Return -ETIMEDOUT if timeout happens.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
drivers/net/phy/marvell.c
drivers/net/phy/phy.c

index b8b1157..d24451b 100644 (file)
@@ -103,7 +103,7 @@ static int m88e1011s_config(struct phy_device *phydev)
 /* Parse the 88E1011's status register for speed and duplex
  * information
  */
-static uint m88e1xxx_parse_status(struct phy_device *phydev)
+static int m88e1xxx_parse_status(struct phy_device *phydev)
 {
        unsigned int speed;
        unsigned int mii_reg;
@@ -120,7 +120,7 @@ static uint m88e1xxx_parse_status(struct phy_device *phydev)
                        if (i > PHY_AUTONEGOTIATE_TIMEOUT) {
                                puts(" TIMEOUT !\n");
                                phydev->link = 0;
-                               break;
+                               return -ETIMEDOUT;
                        }
 
                        if ((i++ % 1000) == 0)
index 23c82bb..68e752e 100644 (file)
@@ -248,7 +248,7 @@ int genphy_update_link(struct phy_device *phydev)
                        if (i > PHY_ANEG_TIMEOUT) {
                                printf(" TIMEOUT !\n");
                                phydev->link = 0;
-                               return 0;
+                               return -ETIMEDOUT;
                        }
 
                        if (ctrlc()) {