net: mscc: ocelot: deinitialize only initialized ports
Currently mscc_ocelot_init_ports() will skip initializing a port when it doesn't have a phy-handle, so the ocelot->ports[port] pointer will be NULL. Take this into consideration when tearing down the driver, and add a new function ocelot_deinit_port() to the switch library, mirror of ocelot_init_port(), which needs to be called by the driver for all ports it has initialized. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.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>
This commit is contained in:

committed by
David S. Miller

parent
22cdb493de
commit
e5fb512d81
@@ -643,10 +643,13 @@ static void felix_teardown(struct dsa_switch *ds)
|
||||
{
|
||||
struct ocelot *ocelot = ds->priv;
|
||||
struct felix *felix = ocelot_to_felix(ocelot);
|
||||
int port;
|
||||
|
||||
if (felix->info->mdio_bus_free)
|
||||
felix->info->mdio_bus_free(ocelot);
|
||||
|
||||
for (port = 0; port < ocelot->num_phys_ports; port++)
|
||||
ocelot_deinit_port(ocelot, port);
|
||||
ocelot_deinit_timestamp(ocelot);
|
||||
/* stop workqueue thread */
|
||||
ocelot_deinit(ocelot);
|
||||
|
Reference in New Issue
Block a user