Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 2a10ab043ac5 ("net: phy: add genphy_check_and_restart_aneg()")
Fixes: 1af9f16840e9 ("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>

authored by

Sudheesh Mavila and committed by
David S. Miller
4f31c532 f596c870

+6 -6
+3 -3
drivers/net/phy/phy-c45.c
··· 167 167 */ 168 168 int genphy_c45_check_and_restart_aneg(struct phy_device *phydev, bool restart) 169 169 { 170 - int ret = 0; 170 + int ret; 171 171 172 172 if (!restart) { 173 173 /* Configure and restart aneg if it wasn't set before */ ··· 180 180 } 181 181 182 182 if (restart) 183 - ret = genphy_c45_restart_aneg(phydev); 183 + return genphy_c45_restart_aneg(phydev); 184 184 185 - return ret; 185 + return 0; 186 186 } 187 187 EXPORT_SYMBOL_GPL(genphy_c45_check_and_restart_aneg); 188 188
+3 -3
drivers/net/phy/phy_device.c
··· 1793 1793 */ 1794 1794 int genphy_check_and_restart_aneg(struct phy_device *phydev, bool restart) 1795 1795 { 1796 - int ret = 0; 1796 + int ret; 1797 1797 1798 1798 if (!restart) { 1799 1799 /* Advertisement hasn't changed, but maybe aneg was never on to ··· 1808 1808 } 1809 1809 1810 1810 if (restart) 1811 - ret = genphy_restart_aneg(phydev); 1811 + return genphy_restart_aneg(phydev); 1812 1812 1813 - return ret; 1813 + return 0; 1814 1814 } 1815 1815 EXPORT_SYMBOL(genphy_check_and_restart_aneg); 1816 1816