summaryrefslogtreecommitdiff
path: root/drivers/net/phy/phy-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/phy/phy-core.c')
-rw-r--r--drivers/net/phy/phy-core.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c
index e75989ce8850..4083f00c97a5 100644
--- a/drivers/net/phy/phy-core.c
+++ b/drivers/net/phy/phy-core.c
@@ -336,16 +336,15 @@ EXPORT_SYMBOL(phy_write_mmd);
*/
int __phy_modify(struct phy_device *phydev, u32 regnum, u16 mask, u16 set)
{
- int ret, res;
+ int ret;
ret = __phy_read(phydev, regnum);
- if (ret >= 0) {
- res = __phy_write(phydev, regnum, (ret & ~mask) | set);
- if (res < 0)
- ret = res;
- }
+ if (ret < 0)
+ return ret;
- return ret;
+ ret = __phy_write(phydev, regnum, (ret & ~mask) | set);
+
+ return ret < 0 ? ret : 0;
}
EXPORT_SYMBOL_GPL(__phy_modify);