]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: phy: xilinx: Check interface type in ->config(), not ->probe()
authorMarek Behún <marek.behun@nic.cz>
Wed, 6 Apr 2022 22:33:05 +0000 (00:33 +0200)
committerRamon Fried <ramon@neureality.ai>
Sun, 10 Apr 2022 05:44:13 +0000 (08:44 +0300)
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 <marek.behun@nic.cz>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
drivers/net/phy/xilinx_gmii2rgmii.c

index 635c0570efeda196eb2e6f1a7f6d2957afe86e2b..d92a364365c00599eb340d877aec8620c9dda4a4 100644 (file)
@@ -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;