summaryrefslogtreecommitdiffstats
path: root/drivers/net/gianfar_mii.c
diff options
context:
space:
mode:
authorAndy Fleming <afleming@freescale.com>2008-09-22 14:10:25 -0700
committerJeff Garzik <jgarzik@redhat.com>2008-09-24 20:49:02 -0400
commitac7198bb124e7007cfd48990d382678341886dba (patch)
tree660492cf1a75847f943b7b5063630103d377692f /drivers/net/gianfar_mii.c
parentfbb80230bf1c1dcc81339e991b172006243333e9 (diff)
downloadop-kernel-dev-ac7198bb124e7007cfd48990d382678341886dba.zip
op-kernel-dev-ac7198bb124e7007cfd48990d382678341886dba.tar.gz
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. 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>
Diffstat (limited to 'drivers/net/gianfar_mii.c')
-rw-r--r--drivers/net/gianfar_mii.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c
index 906aba2..678f48c 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);
OpenPOWER on IntegriCloud