Commit 4f31c532 authored by Sudheesh Mavila's avatar Sudheesh Mavila Committed by David S. Miller

net: phy: corrected the return value for genphy_check_and_restart_aneg and...

net: phy: corrected the return value for genphy_check_and_restart_aneg and genphy_c45_check_and_restart_aneg

When auto-negotiation is not required, return value should be zero.

Changes v1->v2:
- improved comments and code as Andrew Lunn and Heiner Kallweit suggestion
- fixed issue in genphy_c45_check_and_restart_aneg as Russell King
  suggestion.

Fixes: 2a10ab04 ("net: phy: add genphy_check_and_restart_aneg()")
Fixes: 1af9f168 ("net: phy: add genphy_c45_check_and_restart_aneg()")
Signed-off-by: default avatarSudheesh Mavila <sudheesh.mavila@amd.com>
Reviewed-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f596c870
......@@ -167,7 +167,7 @@ EXPORT_SYMBOL_GPL(genphy_c45_restart_aneg);
*/
int genphy_c45_check_and_restart_aneg(struct phy_device *phydev, bool restart)
{
int ret = 0;
int ret;
if (!restart) {
/* Configure and restart aneg if it wasn't set before */
......@@ -180,9 +180,9 @@ int genphy_c45_check_and_restart_aneg(struct phy_device *phydev, bool restart)
}
if (restart)
ret = genphy_c45_restart_aneg(phydev);
return genphy_c45_restart_aneg(phydev);
return ret;
return 0;
}
EXPORT_SYMBOL_GPL(genphy_c45_check_and_restart_aneg);
......
......@@ -1793,7 +1793,7 @@ EXPORT_SYMBOL(genphy_restart_aneg);
*/
int genphy_check_and_restart_aneg(struct phy_device *phydev, bool restart)
{
int ret = 0;
int ret;
if (!restart) {
/* Advertisement hasn't changed, but maybe aneg was never on to
......@@ -1808,9 +1808,9 @@ int genphy_check_and_restart_aneg(struct phy_device *phydev, bool restart)
}
if (restart)
ret = genphy_restart_aneg(phydev);
return genphy_restart_aneg(phydev);
return ret;
return 0;
}
EXPORT_SYMBOL(genphy_check_and_restart_aneg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment