From: Marek BehĂșn Date: Wed, 6 Apr 2022 22:33:05 +0000 (+0200) Subject: net: phy: xilinx: Check interface type in ->config(), not ->probe() X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=f961b3abf88d2922e064a0b83525929aab917f1f;p=u-boot.git net: phy: xilinx: Check interface type in ->config(), not ->probe() We want to be able to have phydev->interface uninitialized during ->probe(). We should assume that phydev->interface is initialized only before ->config(). Signed-off-by: Marek BehĂșn Reviewed-by: Ramon Fried --- diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c index 635c0570ef..d92a364365 100644 --- a/drivers/net/phy/xilinx_gmii2rgmii.c +++ b/drivers/net/phy/xilinx_gmii2rgmii.c @@ -26,6 +26,11 @@ static int xilinxgmiitorgmii_config(struct phy_device *phydev) debug("%s\n", __func__); + if (phydev->interface != PHY_INTERFACE_MODE_GMII) { + printf("Incorrect interface type\n"); + return -EINVAL; + } + if (!ofnode_valid(node)) return -EINVAL; @@ -114,11 +119,6 @@ static int xilinxgmiitorgmii_probe(struct phy_device *phydev) { debug("%s\n", __func__); - if (phydev->interface != PHY_INTERFACE_MODE_GMII) { - printf("Incorrect interface type\n"); - return -EINVAL; - } - phydev->flags |= PHY_FLAG_BROKEN_RESET; return 0;