From: Michael Walle <michael@walle.cc>
To: u-boot@lists.denx.de
Subject: [PATCH 1/4] net: dsa: return early if there is no master
Date: Wed, 24 Feb 2021 17:40:39 +0100 [thread overview]
Message-ID: <20210224164042.21747-2-michael@walle.cc> (raw)
In-Reply-To: <20210224164042.21747-1-michael@walle.cc>
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>
---
net/dsa-uclass.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/dsa-uclass.c b/net/dsa-uclass.c
index 2ce9ddb90d..88a8ea9352 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);
--
2.20.1
next prev parent reply other threads:[~2021-02-24 16:40 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-24 16:40 [PATCH 0/4] net: dsa: various fixes Michael Walle
2021-02-24 16:40 ` Michael Walle [this message]
2021-02-25 19:12 ` [PATCH 1/4] net: dsa: return early if there is no master Ramon Fried
2021-02-24 16:40 ` [PATCH 2/4] net: dsa: probe master device Michael Walle
2021-02-25 19:13 ` Ramon Fried
2021-02-24 16:40 ` [PATCH 3/4] net: dsa: remove NULL check for priv and platform data Michael Walle
2021-02-24 22:23 ` Vladimir Oltean
2021-02-25 19:14 ` Ramon Fried
2021-02-24 16:40 ` [PATCH 4/4] net: dsa: remove master santiy check Michael Walle
2021-02-24 17:11 ` Vladimir Oltean
2021-02-24 17:29 ` Michael Walle
2021-02-24 17:45 ` Vladimir Oltean
2021-02-24 18:08 ` Michael Walle
2021-02-24 18:19 ` Vladimir Oltean
2021-02-24 19:03 ` Michael Walle
2021-02-24 21:40 ` Vladimir Oltean
2021-02-24 22:25 ` Vladimir Oltean
2021-02-24 22:52 ` Michael Walle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210224164042.21747-2-michael@walle.cc \
--to=michael@walle.cc \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox