lkml.org 
[lkml]   [2020]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] net: phy: corrected the return value for genphy_check_and_restart_aneg
From
Date
On 25.02.2020 13:22, Sudheesh Mavila wrote:
> When auto-negotiation is not required, return value should be zero.
>
> Signed-off-by: Sudheesh Mavila <sudheesh.mavila@amd.com>
> ---
> drivers/net/phy/phy_device.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index 6a5056e0ae77..36cde3dac4c3 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -1806,10 +1806,13 @@ int genphy_check_and_restart_aneg(struct phy_device *phydev, bool restart)
> restart = true;
> }
>
> - if (restart)
> - ret = genphy_restart_aneg(phydev);
> + /* Only restart aneg if we are advertising something different
> + * than we were before.
> + */
> + if (restart > 0)

In addition to what Russell and Andrew commented already:
- You shouldn't compare a bool with an int. There's no need to change
the original condition.
- The comment isn't really needed, and it's wrong. See the comment few
lines earlier.
- After this change the initialization of ret isn't needed any longer.

> + return genphy_restart_aneg(phydev);
>
> - return ret;
> + return 0;
> }
> EXPORT_SYMBOL(genphy_check_and_restart_aneg);
>
>

\
 
 \ /
  Last update: 2020-02-25 14:59    [W:0.093 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site