summaryrefslogtreecommitdiffstats
path: root/net/dsa/slave.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2015-02-25 08:02:02 +0100
committerDavid S. Miller <davem@davemloft.net>2015-02-25 23:57:48 +0100
commitd79d21073626cf022943e5c4c10a97cdf7cb8465 (patch)
tree529fa340e3b007cce36bb7665f1eef4807bdb5b4 /net/dsa/slave.c
parentMerge branch 'sf2_hwbridge' (diff)
downloadlinux-d79d21073626cf022943e5c4c10a97cdf7cb8465.tar.xz
linux-d79d21073626cf022943e5c4c10a97cdf7cb8465.zip
net: dsa: Introduce dsa_is_port_initialized
To avoid race conditions when using the ds->ports[] array, we need to check if the accessed port has been initialized. Introduce and use helper function dsa_is_port_initialized for that purpose and use it where needed. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--net/dsa/slave.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index b5a4d8974b76..a47305c72fcc 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -222,10 +222,7 @@ static u32 dsa_slave_br_port_mask(struct dsa_switch *ds,
u32 mask = 0;
for (port = 0; port < DSA_MAX_PORTS; port++) {
- if (!((1 << port) & ds->phys_port_mask))
- continue;
-
- if (!ds->ports[port])
+ if (!dsa_is_port_initialized(ds, port))
continue;
p = netdev_priv(ds->ports[port]);