Skip to contentSkip to conversation

gianfar: Free/iounmap memory after an error in mii bus initialization

PATCH In review Andy Fleming 2 participants 2 messages Sep 18, 2008 – Sep 20, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gianfar: Free/iounmap memory after an error in mii bus initialization

Recent changes to MII bus initialization code added exit points which didn't free or iounmap the bus before returning.

This was reported as bug #11372

---
 drivers/net/gianfar_mii.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
drivers/net/gianfar_mii.c +8 -6
index ebcfb27..4804ec1 100644
@@ -211,19 +211,21 @@ static int gfar_mdio_probe(struct device *dev)
 	gfar_write(&enet_regs->tbipa, 0);
 	for (i = PHY_MAX_ADDR; i > 0; i--) {
 		u32 phy_id;
-		int r;
 
-		r = get_phy_id(new_bus, i, &phy_id);
-		if (r)
-			return r;
+		err = get_phy_id(new_bus, i, &phy_id);
+		if (err)
+			goto bus_register_fail;
 
 		if (phy_id == 0xffffffff)
 			break;
 	}
 
 	/* The bus is full.  We don't support using 31 PHYs, sorry */
-	if (i == 0)
-		return -EBUSY;
+	if (i == 0) {
+		err = -EBUSY;
+
+		goto bus_register_fail;
+	}
 
 	gfar_write(&enet_regs->tbipa, i);
 
Signature · 1 line
1.5.4.GIT
#1 lore raw
Quoted 6 lines · On Thu, 18 Sep 2008 16:37:54 -0500 Andy Fleming <[email protected]> wrote:

Recent changes to MII bus initialization code added exit points which didn't free or iounmap the bus before returning.

This was reported as bug #11372

administrivia:

- Adding a

would be nice.

- When referencing a bugzilla report in the changelog I like to use the full URL. Because there are people who periodically troll the mainline commits closing off bugzilla reports. Using the full URL minimises the chance that they will miss something.