Commit 2c673015 authored by Marek Vasut's avatar Marek Vasut Committed by Jakub Kicinski
Browse files

net: phy: realtek: Avoid PHYCR2 access if PHYCR2 not present



The driver is currently checking for PHYCR2 register presence in
rtl8211f_config_init(), but it does so after accessing PHYCR2 to
disable EEE. This was introduced in commit bfc17c16 ("net:
phy: realtek: disable PHY-mode EEE"). Move the PHYCR2 presence
test before the EEE disablement and simplify the code.

Fixes: bfc17c16 ("net: phy: realtek: disable PHY-mode EEE")
Signed-off-by: default avatarMarek Vasut <marek.vasut@mailbox.org>
Reviewed-by: default avatarMaxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/20251011110309.12664-1-marek.vasut@mailbox.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent d1d5df46
Loading
Loading
Loading
Loading
+11 −12
Original line number Diff line number Diff line
@@ -633,13 +633,15 @@ static int rtl8211f_config_init(struct phy_device *phydev)
			str_enabled_disabled(val_rxdly));
	}

	if (!priv->has_phycr2)
		return 0;

	/* Disable PHY-mode EEE so LPI is passed to the MAC */
	ret = phy_modify_paged(phydev, RTL8211F_PHYCR_PAGE, RTL8211F_PHYCR2,
			       RTL8211F_PHYCR2_PHY_EEE_ENABLE, 0);
	if (ret)
		return ret;

	if (priv->has_phycr2) {
	ret = phy_modify_paged(phydev, RTL8211F_PHYCR_PAGE,
			       RTL8211F_PHYCR2, RTL8211F_CLKOUT_EN,
			       priv->phycr2);
@@ -652,9 +654,6 @@ static int rtl8211f_config_init(struct phy_device *phydev)
	return genphy_soft_reset(phydev);
}

	return 0;
}

static int rtl821x_suspend(struct phy_device *phydev)
{
	struct rtl821x_priv *priv = phydev->priv;