aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/gianfar_mii.c
diff options
context:
space:
mode:
authorAndy Fleming <afleming@freescale.com>2008-09-22 17:10:25 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-09-24 20:49:02 -0400
commitac7198bb124e7007cfd48990d382678341886dba (patch)
tree660492cf1a75847f943b7b5063630103d377692f /drivers/net/gianfar_mii.c
parentfbb80230bf1c1dcc81339e991b172006243333e9 (diff)
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 906aba2757e7..678f48c69119 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)
211 gfar_write(&enet_regs->tbipa, 0); 211 gfar_write(&enet_regs->tbipa, 0);
212 for (i = PHY_MAX_ADDR; i > 0; i--) { 212 for (i = PHY_MAX_ADDR; i > 0; i--) {
213 u32 phy_id; 213 u32 phy_id;
214 int r;
215 214
216 r = get_phy_id(new_bus, i, &phy_id); 215 err = get_phy_id(new_bus, i, &phy_id);
217 if (r) 216 if (err)
218 return r; 217 goto bus_register_fail;
219 218
220 if (phy_id == 0xffffffff) 219 if (phy_id == 0xffffffff)
221 break; 220 break;
222 } 221 }
223 222
224 /* The bus is full. We don't support using 31 PHYs, sorry */ 223 /* The bus is full. We don't support using 31 PHYs, sorry */
225 if (i == 0) 224 if (i == 0) {
226 return -EBUSY; 225 err = -EBUSY;
226
227 goto bus_register_fail;
228 }
227 229
228 gfar_write(&enet_regs->tbipa, i); 230 gfar_write(&enet_regs->tbipa, i);
229 231