Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 34786005 authored by Camelia Groza's avatar Camelia Groza Committed by David S. Miller
Browse files

net: phy: prevent PHYs w/o Clause 22 regs from calling genphy_config_aneg



genphy_config_aneg() should be called only by PHYs that implement
the Clause 22 register set. Prevent Clause 45 PHYs that don't implement
the register set from calling the genphy function.

Signed-off-by: default avatarCamelia Groza <camelia.groza@nxp.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7e50b2a5
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -471,7 +471,13 @@ static int phy_config_aneg(struct phy_device *phydev)
{
	if (phydev->drv->config_aneg)
		return phydev->drv->config_aneg(phydev);
	else

	/* Clause 45 PHYs that don't implement Clause 22 registers are not
	 * allowed to call genphy_config_aneg()
	 */
	if (phydev->is_c45 && !(phydev->c45_ids.devices_in_package & BIT(0)))
		return -EOPNOTSUPP;

	return genphy_config_aneg(phydev);
}