Skip to content

Commit

Permalink
net: phy: corrected the return value for genphy_check_and_restart_ane…
Browse files Browse the repository at this point in the history
…g 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: 2a10ab0 ("net: phy: add genphy_check_and_restart_aneg()")
Fixes: 1af9f16 ("net: phy: add genphy_c45_check_and_restart_aneg()")
Signed-off-by: Sudheesh Mavila <sudheesh.mavila@amd.com>
Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Sudheesh Mavila authored and David S. Miller committed Feb 27, 2020
1 parent f596c87 commit 4f31c53
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions drivers/net/phy/phy-c45.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions drivers/net/phy/phy_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);

Expand Down

0 comments on commit 4f31c53

Please sign in to comment.