aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>2023-10-10 21:48:58 +0900
committerPaolo Abeni <pabeni@redhat.com>2023-10-12 11:22:21 +0200
commit053f13f67be6d02781730c9ac71abde6e9140610 (patch)
treedad47ca3b7f6cd6174c3a54d7ec0223482aeb7f1
parent510b18cf23b9bd8a982ef7f1fb19f3968a2bf787 (diff)
downloadlinux-riscv-keystone-053f13f67be6d02781730c9ac71abde6e9140610.tar.gz
rswitch: Fix imbalance phy_power_off() calling
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: 5cb630925b49 ("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>
-rw-r--r--drivers/net/ethernet/renesas/rswitch.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
index 4d7c482880474a..0fc0b6bea75305 100644
--- a/drivers/net/ethernet/renesas/rswitch.c
+++ b/drivers/net/ethernet/renesas/rswitch.c
@@ -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;