diff options
author | Johan Hovold <johan@kernel.org> | 2014-11-11 14:00:13 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-11-12 13:55:36 -0500 |
commit | b7035860a1dee6da1a6f3da4a38c8235dab05cb9 (patch) | |
tree | b64fd66fce147d090fab1ce9435d670354e2e99e /drivers/net/phy/micrel.c | |
parent | 8620546c39a379e3b0cc5210519c0bc22377b914 (diff) |
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/micrel.c')
-rw-r--r-- | drivers/net/phy/micrel.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 1b3985cdc64c..ec9ce35e934b 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, | |||
179 | } | 179 | } |
180 | 180 | ||
181 | temp = phy_read(phydev, reg); | 181 | temp = phy_read(phydev, reg); |
182 | if (temp < 0) | 182 | if (temp < 0) { |
183 | return temp; | 183 | rc = temp; |
184 | goto out; | ||
185 | } | ||
184 | 186 | ||
185 | temp &= ~(3 << shift); | 187 | temp &= ~(3 << shift); |
186 | temp |= val << shift; | 188 | temp |= val << shift; |
187 | rc = phy_write(phydev, reg, temp); | 189 | rc = phy_write(phydev, reg, temp); |
190 | out: | ||
191 | if (rc < 0) | ||
192 | dev_err(&phydev->dev, "failed to set led mode\n"); | ||
188 | 193 | ||
189 | return rc < 0 ? rc : 0; | 194 | return rc; |
190 | } | 195 | } |
191 | 196 | ||
192 | /* Disable PHY address 0 as the broadcast address, so that it can be used as a | 197 | /* 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) | |||
223 | { | 228 | { |
224 | int rc; | 229 | int rc; |
225 | 230 | ||
226 | rc = kszphy_setup_led(phydev, 0x1f, 4); | 231 | kszphy_setup_led(phydev, 0x1f, 4); |
227 | if (rc) | ||
228 | dev_err(&phydev->dev, "failed to set led mode\n"); | ||
229 | 232 | ||
230 | rc = ksz_config_flags(phydev); | 233 | rc = ksz_config_flags(phydev); |
231 | if (rc < 0) | 234 | if (rc < 0) |
@@ -240,9 +243,7 @@ static int ks8051_config_init(struct phy_device *phydev) | |||
240 | { | 243 | { |
241 | int rc; | 244 | int rc; |
242 | 245 | ||
243 | rc = kszphy_setup_led(phydev, 0x1f, 4); | 246 | kszphy_setup_led(phydev, 0x1f, 4); |
244 | if (rc) | ||
245 | dev_err(&phydev->dev, "failed to set led mode\n"); | ||
246 | 247 | ||
247 | rc = ksz_config_flags(phydev); | 248 | rc = ksz_config_flags(phydev); |
248 | return rc < 0 ? rc : 0; | 249 | return rc < 0 ? rc : 0; |