summaryrefslogtreecommitdiffstats
path: root/drivers/net/phy
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2014-11-11 20:00:13 +0100
committerDavid S. Miller <davem@davemloft.net>2014-11-12 13:55:36 -0500
commitb7035860a1dee6da1a6f3da4a38c8235dab05cb9 (patch)
treeb64fd66fce147d090fab1ce9435d670354e2e99e /drivers/net/phy
parent8620546c39a379e3b0cc5210519c0bc22377b914 (diff)
downloadop-kernel-dev-b7035860a1dee6da1a6f3da4a38c8235dab05cb9.zip
op-kernel-dev-b7035860a1dee6da1a6f3da4a38c8235dab05cb9.tar.gz
net: phy: micrel: refactor led-mode error handling
Refactor led-mode error handling. Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r--drivers/net/phy/micrel.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 1b3985c..ec9ce35e9 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -179,14 +179,19 @@ static int kszphy_setup_led(struct phy_device *phydev,
}
temp = phy_read(phydev, reg);
- if (temp < 0)
- return temp;
+ if (temp < 0) {
+ rc = temp;
+ goto out;
+ }
temp &= ~(3 << shift);
temp |= val << shift;
rc = phy_write(phydev, reg, temp);
+out:
+ if (rc < 0)
+ dev_err(&phydev->dev, "failed to set led mode\n");
- return rc < 0 ? rc : 0;
+ return rc;
}
/* Disable PHY address 0 as the broadcast address, so that it can be used as a
@@ -223,9 +228,7 @@ static int ksz8021_config_init(struct phy_device *phydev)
{
int rc;
- rc = kszphy_setup_led(phydev, 0x1f, 4);
- if (rc)
- dev_err(&phydev->dev, "failed to set led mode\n");
+ kszphy_setup_led(phydev, 0x1f, 4);
rc = ksz_config_flags(phydev);
if (rc < 0)
@@ -240,9 +243,7 @@ static int ks8051_config_init(struct phy_device *phydev)
{
int rc;
- rc = kszphy_setup_led(phydev, 0x1f, 4);
- if (rc)
- dev_err(&phydev->dev, "failed to set led mode\n");
+ kszphy_setup_led(phydev, 0x1f, 4);
rc = ksz_config_flags(phydev);
return rc < 0 ? rc : 0;
OpenPOWER on IntegriCloud