Browse Source

net: phy: mv88e61xx: Fix uninitialized variable warning

The variable 'res' may be unused uninitialized if our call to
mv88e61xx_port_read (register read) fails and we goto the error
handling section.  In this case we set 'res' to -EIO to indicate why we
failed.

Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Chris Packham <judge.packham@gmail.com>
Cc: Kevin Smith <kevin.smith@elecsyscorp.com>
Cc: Prafulla Wadaskar <prafulla@marvell.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Tom Rini 8 years ago
parent
commit
4201223de8
1 changed files with 3 additions and 1 deletions
  1. 3 1
      drivers/net/phy/mv88e61xx.c

+ 3 - 1
drivers/net/phy/mv88e61xx.c

@@ -655,8 +655,10 @@ static int mv88e61xx_read_port_config(struct phy_device *phydev, u8 port)
 		do {
 			val = mv88e61xx_port_read(phydev, port,
 						  PORT_REG_STATUS);
-			if (val < 0)
+			if (val < 0) {
+				res = -EIO;
 				goto unforce;
+			}
 			if (val & PORT_REG_STATUS_LINK)
 				break;
 		} while (--timeout);