From f961b3abf88d2922e064a0b83525929aab917f1f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Beh=C3=BAn?= Date: Thu, 7 Apr 2022 00:33:05 +0200 Subject: [PATCH] net: phy: xilinx: Check interface type in ->config(), not ->probe() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- drivers/net/phy/xilinx_gmii2rgmii.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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; -- 2.39.5