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

Subsystems: networking drivers, the rest

STALE6526d

2 messages, 2 authors, 2008-09-20 · open the first message on its own page

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

From: Andy Fleming <hidden>
Date: 2008-09-18 21:37:59

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

Signed-off-by: Andy Fleming <redacted>
---
 drivers/net/gianfar_mii.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c
index ebcfb27..4804ec1 100644
--- a/drivers/net/gianfar_mii.c
+++ b/drivers/net/gianfar_mii.c
@@ -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);
 
-- 
1.5.4.GIT

Re: [PATCH] gianfar: Free/iounmap memory after an error in mii bus initialization

From: Andrew Morton <akpm@linux-foundation.org>
Date: 2008-09-20 00:25:17

On Thu, 18 Sep 2008 16:37:54 -0500
Andy Fleming [off-list ref] 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

Signed-off-by: Andy Fleming <redacted>
administrivia:

- Adding a

	Reported-by: Daniel Marjamki [off-list ref]

  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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help