net: dsa: add missing dsa_switch mdiobus remove
authorNeil Armstrong <narmstrong@baylibre.com>
Tue, 6 Oct 2015 14:40:25 +0000 (15:40 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 7 Oct 2015 11:56:07 +0000 (04:56 -0700)
To prevent memory leakage on unbinding, add missing mdiobus unregister
and unallocation calls.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/dsa.c

index ed9d43fd1fecd3dbe1af8ee96995fd46db07b762..14fac4ed956939723cb87498a8e53b1b94135cb9 100644 (file)
@@ -424,6 +424,8 @@ static void dsa_switch_destroy(struct dsa_switch *ds)
        if (ds->hwmon_dev)
                hwmon_device_unregister(ds->hwmon_dev);
 #endif
+       mdiobus_unregister(ds->slave_mii_bus);
+       mdiobus_free(ds->slave_mii_bus);
 }
 
 #ifdef CONFIG_PM_SLEEP