Skip to content
Snippets Groups Projects
Commit a02dcbbb authored by Michael Walle's avatar Michael Walle Committed by Priyanka Jain
Browse files

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: fc054d56 ("net: Introduce DSA class for Ethernet switches")
Signed-off-by: default avatarMichael Walle <michael@walle.cc>
Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: default avatarRamon Fried <rfried.dev@gmail.com>
Reviewed-by: default avatarPriyanka Jain <priyanka.jain@nxp.com>
parent 6ce33e22
No related branches found
No related tags found
No related merge requests found
...@@ -280,6 +280,10 @@ static int dsa_port_probe(struct udevice *pdev) ...@@ -280,6 +280,10 @@ static int dsa_port_probe(struct udevice *pdev)
if (!port_pdata->phy) if (!port_pdata->phy)
return -ENODEV; return -ENODEV;
master = dsa_get_master(dev);
if (!master)
return -ENODEV;
/* /*
* Inherit port's hwaddr from the DSA master, unless the port already * Inherit port's hwaddr from the DSA master, unless the port already
* has a unique MAC address specified in the environment. * has a unique MAC address specified in the environment.
...@@ -288,10 +292,6 @@ static int dsa_port_probe(struct udevice *pdev) ...@@ -288,10 +292,6 @@ static int dsa_port_probe(struct udevice *pdev)
if (!is_zero_ethaddr(env_enetaddr)) if (!is_zero_ethaddr(env_enetaddr))
return 0; return 0;
master = dsa_get_master(dev);
if (!master)
return 0;
master_pdata = dev_get_plat(master); master_pdata = dev_get_plat(master);
eth_pdata = dev_get_plat(pdev); eth_pdata = dev_get_plat(pdev);
memcpy(eth_pdata->enetaddr, master_pdata->enetaddr, ARP_HLEN); memcpy(eth_pdata->enetaddr, master_pdata->enetaddr, ARP_HLEN);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment