diff mbox series

[net] net: dsa: felix: don't deinitialize unused ports

Message ID 20210216111446.2850726-1-olteanv@gmail.com (mailing list archive)
State Accepted
Commit 42b5adbbac03bdb396192316c015fa3e64ffd5a1
Delegated to: Netdev Maintainers
Headers show
Series [net] net: dsa: felix: don't deinitialize unused ports | expand

Checks

Context Check Description
netdev/apply fail Patch does not apply to net
netdev/tree_selection success Clearly marked for net

Commit Message

Vladimir Oltean Feb. 16, 2021, 11:14 a.m. UTC
From: Vladimir Oltean <vladimir.oltean@nxp.com>

ocelot_init_port is called only if dsa_is_unused_port == false, however
ocelot_deinit_port is called unconditionally. This causes a warning in
the skb_queue_purge inside ocelot_deinit_port saying that the spin lock
protecting ocelot_port->tx_skbs was not initialized.

Fixes: e5fb512d81d0 ("net: mscc: ocelot: deinitialize only initialized ports")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/dsa/ocelot/felix.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org Feb. 16, 2021, 10:10 p.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Tue, 16 Feb 2021 13:14:46 +0200 you wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> ocelot_init_port is called only if dsa_is_unused_port == false, however
> ocelot_deinit_port is called unconditionally. This causes a warning in
> the skb_queue_purge inside ocelot_deinit_port saying that the spin lock
> protecting ocelot_port->tx_skbs was not initialized.
> 
> [...]

Here is the summary with links:
  - [net] net: dsa: felix: don't deinitialize unused ports
    https://git.kernel.org/netdev/net-next/c/42b5adbbac03

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index 800f27d65c6c..3e72f0a79918 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -1262,8 +1262,12 @@  static void felix_teardown(struct dsa_switch *ds)
 	ocelot_deinit_timestamp(ocelot);
 	ocelot_deinit(ocelot);
 
-	for (port = 0; port < ocelot->num_phys_ports; port++)
+	for (port = 0; port < ocelot->num_phys_ports; port++) {
+		if (dsa_is_unused_port(ds, port))
+			continue;
+
 		ocelot_deinit_port(ocelot, port);
+	}
 
 	if (felix->info->mdio_bus_free)
 		felix->info->mdio_bus_free(ocelot);