Skip to content

Commit

Permalink
rswitch: Fix imbalance phy_power_off() calling
Browse files Browse the repository at this point in the history
The phy_power_off() should not be called if phy_power_on() failed.
So, add a condition .power_count before calls phy_power_off().

Fixes: 5cb6309 ("net: renesas: rswitch: Add phy_power_{on,off}() calling")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Yoshihiro Shimoda authored and Paolo Abeni committed Oct 12, 2023
1 parent 510b18c commit 053f13f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/renesas/rswitch.c
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,7 @@ static void rswitch_adjust_link(struct net_device *ndev)
phy_print_status(phydev);
if (phydev->link)
phy_power_on(rdev->serdes);
else
else if (rdev->serdes->power_count)
phy_power_off(rdev->serdes);

rdev->etha->link = phydev->link;
Expand Down

0 comments on commit 053f13f

Please sign in to comment.