Skip to contentSkip to conversation

Patch "net: dsa: mv88e6xxx: Unregister MDIO bus on error path" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Feb 23, 2018

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

net: dsa: mv88e6xxx: Unregister MDIO bus on error path

to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
net-dsa-mv88e6xxx-unregister-mdio-bus-on-error-path.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Fri Feb 23 11:45:09 CET 2018

From: Andrew Lunn <[email protected]>
Date: Thu, 7 Dec 2017 01:05:57 +0100
Subject: net: dsa: mv88e6xxx: Unregister MDIO bus on error path

From: Andrew Lunn <[email protected]>

[ Upstream commit 3126aeec5313565bfa19e2dd8fd7e3c3390514cb ]

The MDIO busses need to be unregistered before they are freed, otherwise BUG() is called. Add a call to the unregister code if the registration fails, since we can have multiple busses, of which some may correctly register before one fails. This requires moving the code around a little.

Fixes a3c53be55c95 ("net: dsa: mv88e6xxx: Support multiple MDIO busses")
---
 drivers/net/dsa/mv88e6xxx/chip.c |   30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)
drivers/net/dsa/mv88e6xxx/chip.c +16 -14
@@ -2153,6 +2153,19 @@ static const struct of_device_id mv88e6x
 	{ },
 };
 
+static void mv88e6xxx_mdios_unregister(struct mv88e6xxx_chip *chip)
+
+{
+	struct mv88e6xxx_mdio_bus *mdio_bus;
+	struct mii_bus *bus;
+
+	list_for_each_entry(mdio_bus, &chip->mdios, list) {
+		bus = mdio_bus->bus;
+
+		mdiobus_unregister(bus);
+	}
+}
+
 static int mv88e6xxx_mdios_register(struct mv88e6xxx_chip *chip,
 				    struct device_node *np)
 {
@@ -2177,27 +2190,16 @@ static int mv88e6xxx_mdios_register(stru
 		match = of_match_node(mv88e6xxx_mdio_external_match, child);
 		if (match) {
 			err = mv88e6xxx_mdio_register(chip, child, true);
-			if (err)
+			if (err) {
+				mv88e6xxx_mdios_unregister(chip);
 				return err;
+			}
 		}
 	}
 
 	return 0;
 }
 
-static void mv88e6xxx_mdios_unregister(struct mv88e6xxx_chip *chip)
-
-{
-	struct mv88e6xxx_mdio_bus *mdio_bus;
-	struct mii_bus *bus;
-
-	list_for_each_entry(mdio_bus, &chip->mdios, list) {
-		bus = mdio_bus->bus;
-
-		mdiobus_unregister(bus);
-	}
-}
-
 static int mv88e6xxx_get_eeprom_len(struct dsa_switch *ds)
 {
 	struct mv88e6xxx_chip *chip = ds->priv;

Patches currently in stable-queue which might be from [email protected] are

queue-4.14/net-dsa-mv88e6xxx-fix-interrupt-masking-on-removal.patch queue-4.14/net-dsa-mv88e6xxx-unregister-mdio-bus-on-error-path.patch queue-4.14/gianfar-disable-eee-autoneg-by-default.patch