summaryrefslogtreecommitdiff
path: root/drivers/net/dsa/qca
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2024-06-20 19:25:48 +0200
committerDavid S. Miller <davem@davemloft.net>2024-06-21 12:22:59 +0100
commite85d3e6fea05c8ae21a40809a3c6b7adc97411c7 (patch)
treeff92a9bb419e3562fd42fda552e174507842824b /drivers/net/dsa/qca
parent28ba5c11719134b39cc593e67b15fa666cd03bd8 (diff)
net: dsa: qca8k: do not write port mask twice in bridge join/leave
qca8k_port_bridge_join() set QCA8K_PORT_LOOKUP_CTRL() for i == port twice, once in the loop handling all other port's masks, and finally at the end with the accumulated port_mask. The first time it would incorrectly set the port's own bit in the mask, only to correct the mistake a moment later. qca8k_port_bridge_leave() had the same issue, but here the regmap_clear_bits() was a no-op rather than setting an unintended value. Remove the duplicate assignment by skipping the whole loop iteration for i == port. The unintended bit setting doesn't seem to have any negative effects (even when not reverted right away), so the change is submitted as a simple cleanup rather than a fix. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net> Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/qca')
-rw-r--r--drivers/net/dsa/qca/qca8k-common.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/dsa/qca/qca8k-common.c b/drivers/net/dsa/qca/qca8k-common.c
index 7f80035c5441..b33df84070d3 100644
--- a/drivers/net/dsa/qca/qca8k-common.c
+++ b/drivers/net/dsa/qca/qca8k-common.c
@@ -653,6 +653,8 @@ int qca8k_port_bridge_join(struct dsa_switch *ds, int port,
port_mask = BIT(cpu_port);
for (i = 0; i < QCA8K_NUM_PORTS; i++) {
+ if (i == port)
+ continue;
if (dsa_is_cpu_port(ds, i))
continue;
if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge))
@@ -665,8 +667,7 @@ int qca8k_port_bridge_join(struct dsa_switch *ds, int port,
BIT(port));
if (ret)
return ret;
- if (i != port)
- port_mask |= BIT(i);
+ port_mask |= BIT(i);
}
/* Add all other ports to this ports portvlan mask */
@@ -685,6 +686,8 @@ void qca8k_port_bridge_leave(struct dsa_switch *ds, int port,
cpu_port = dsa_to_port(ds, port)->cpu_dp->index;
for (i = 0; i < QCA8K_NUM_PORTS; i++) {
+ if (i == port)
+ continue;
if (dsa_is_cpu_port(ds, i))
continue;
if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge))