diff options
author | Michael Walle <michael@walle.cc> | 2021-02-24 17:40:39 +0100 |
---|---|---|
committer | Priyanka Jain <priyanka.jain@nxp.com> | 2021-03-05 10:25:42 +0530 |
commit | a02dcbbb5a8e24a3f6cd3e7f158e1953b82d5e2e (patch) | |
tree | 31e1767fa9851bd260ad6aa47fcb8c9df4996a66 | |
parent | 6ce33e228859126c87a2027d39b16e5c1b2292e1 (diff) | |
download | u-boot-a02dcbbb5a8e24a3f6cd3e7f158e1953b82d5e2e.zip u-boot-a02dcbbb5a8e24a3f6cd3e7f158e1953b82d5e2e.tar.gz u-boot-a02dcbbb5a8e24a3f6cd3e7f158e1953b82d5e2e.tar.bz2 |
net: dsa: return early if there is no master
It doesn't make sense to have DSA without a master port. Error out early
if there is no master port.
Fixes: fc054d563bfb ("net: Introduce DSA class for Ethernet switches")
Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
-rw-r--r-- | net/dsa-uclass.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/dsa-uclass.c b/net/dsa-uclass.c index 2ce9ddb..88a8ea9 100644 --- a/net/dsa-uclass.c +++ b/net/dsa-uclass.c @@ -280,6 +280,10 @@ static int dsa_port_probe(struct udevice *pdev) if (!port_pdata->phy) return -ENODEV; + master = dsa_get_master(dev); + if (!master) + return -ENODEV; + /* * Inherit port's hwaddr from the DSA master, unless the port already * has a unique MAC address specified in the environment. @@ -288,10 +292,6 @@ static int dsa_port_probe(struct udevice *pdev) if (!is_zero_ethaddr(env_enetaddr)) return 0; - master = dsa_get_master(dev); - if (!master) - return 0; - master_pdata = dev_get_plat(master); eth_pdata = dev_get_plat(pdev); memcpy(eth_pdata->enetaddr, master_pdata->enetaddr, ARP_HLEN); |