Skip to content

Commit 22cdb49

Browse files
vladimirolteandavem330
authored andcommitted
net: mscc: ocelot: unregister net devices on unbind
This driver was not unregistering its network interfaces on unbind. Now it is. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Tested-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 7c41179 commit 22cdb49

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

drivers/net/ethernet/mscc/ocelot_vsc7514.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,26 @@ static struct ptp_clock_info ocelot_ptp_clock_info = {
896896
.enable = ocelot_ptp_enable,
897897
};
898898

899+
static void mscc_ocelot_release_ports(struct ocelot *ocelot)
900+
{
901+
int port;
902+
903+
for (port = 0; port < ocelot->num_phys_ports; port++) {
904+
struct ocelot_port_private *priv;
905+
struct ocelot_port *ocelot_port;
906+
907+
ocelot_port = ocelot->ports[port];
908+
if (!ocelot_port)
909+
continue;
910+
911+
priv = container_of(ocelot_port, struct ocelot_port_private,
912+
port);
913+
914+
unregister_netdev(priv->dev);
915+
free_netdev(priv->dev);
916+
}
917+
}
918+
899919
static int mscc_ocelot_init_ports(struct platform_device *pdev,
900920
struct device_node *ports)
901921
{
@@ -1132,6 +1152,7 @@ static int mscc_ocelot_remove(struct platform_device *pdev)
11321152
struct ocelot *ocelot = platform_get_drvdata(pdev);
11331153

11341154
ocelot_deinit_timestamp(ocelot);
1155+
mscc_ocelot_release_ports(ocelot);
11351156
ocelot_deinit(ocelot);
11361157
unregister_switchdev_blocking_notifier(&ocelot_switchdev_blocking_nb);
11371158
unregister_switchdev_notifier(&ocelot_switchdev_nb);

0 commit comments

Comments
 (0)