Skip to content

Commit

Permalink
gianfar: free/iounmap memory after an error in mii bus initialization
Browse files Browse the repository at this point in the history
Recent changes to MII bus initialization code added exit points which
didn't free or iounmap the bus before returning.

Addresses http://bugzilla.kernel.org/show_bug.cgi?id=11372.

Signed-off-by: Andy Fleming <afleming@freescale.com>
Reported-by: Daniel Marjamki <danielm77@spray.se>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
  • Loading branch information
Andy Fleming authored and Jeff Garzik committed Sep 25, 2008
1 parent fbb8023 commit ac7198b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions drivers/net/gianfar_mii.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit ac7198b

Please sign in to comment.