]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
phy: make phy_connect_fixed work with a null mdio bus
authorVladimir Oltean <vladimir.oltean@nxp.com>
Thu, 16 Jul 2020 10:09:08 +0000 (18:09 +0800)
committerTom Rini <trini@konsulko.com>
Thu, 24 Sep 2020 12:27:44 +0000 (08:27 -0400)
It is utterly pointless to require an MDIO bus pointer for a fixed PHY
device. The fixed.c implementation does not require it, only
phy_device_create. Fix that.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
drivers/net/phy/phy.c

index 67789897c2569aa969fe21af1adc98a120ef69fd..9587e6b9fae411013e785bad2a3eaee4d1f88693 100644 (file)
@@ -664,7 +664,7 @@ static struct phy_device *phy_device_create(struct mii_dev *bus, int addr,
        dev = malloc(sizeof(*dev));
        if (!dev) {
                printf("Failed to allocate PHY device for %s:%d\n",
-                      bus->name, addr);
+                      bus ? bus->name : "(null bus)", addr);
                return NULL;
        }
 
@@ -692,7 +692,7 @@ static struct phy_device *phy_device_create(struct mii_dev *bus, int addr,
                return NULL;
        }
 
-       if (addr >= 0 && addr < PHY_MAX_ADDR)
+       if (addr >= 0 && addr < PHY_MAX_ADDR && phy_id != PHY_FIXED_ID)
                bus->phymap[addr] = dev;
 
        return dev;