aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/fec.c
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2011-01-13 15:44:18 -0500
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2011-02-15 03:26:28 -0500
commit28e2188efc614c714c69dd5c3f063e066e80d3ba (patch)
treee9db61aa5324f31d051efdaef6d898db7a384f8d /drivers/net/fec.c
parent8a73b0bc86366113e13d079b3de76df6e94a4a5c (diff)
net/fec: release mem_region requested in probe in error path and remove
Reported-by: Lothar Waßmann <LW@KARO-electronics.de> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'drivers/net/fec.c')
-rw-r--r--drivers/net/fec.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 3e6e923ca59b..b079826586ef 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -1377,8 +1377,10 @@ fec_probe(struct platform_device *pdev)
1377 1377
1378 /* Init network device */ 1378 /* Init network device */
1379 ndev = alloc_etherdev(sizeof(struct fec_enet_private)); 1379 ndev = alloc_etherdev(sizeof(struct fec_enet_private));
1380 if (!ndev) 1380 if (!ndev) {
1381 return -ENOMEM; 1381 ret = -ENOMEM;
1382 goto failed_alloc_etherdev;
1383 }
1382 1384
1383 SET_NETDEV_DEV(ndev, &pdev->dev); 1385 SET_NETDEV_DEV(ndev, &pdev->dev);
1384 1386
@@ -1456,6 +1458,8 @@ failed_irq:
1456 iounmap((void __iomem *)ndev->base_addr); 1458 iounmap((void __iomem *)ndev->base_addr);
1457failed_ioremap: 1459failed_ioremap:
1458 free_netdev(ndev); 1460 free_netdev(ndev);
1461failed_alloc_etherdev:
1462 release_mem_region(r->start, resource_size(r));
1459 1463
1460 return ret; 1464 return ret;
1461} 1465}
@@ -1465,6 +1469,7 @@ fec_drv_remove(struct platform_device *pdev)
1465{ 1469{
1466 struct net_device *ndev = platform_get_drvdata(pdev); 1470 struct net_device *ndev = platform_get_drvdata(pdev);
1467 struct fec_enet_private *fep = netdev_priv(ndev); 1471 struct fec_enet_private *fep = netdev_priv(ndev);
1472 struct resource *r;
1468 1473
1469 platform_set_drvdata(pdev, NULL); 1474 platform_set_drvdata(pdev, NULL);
1470 1475
@@ -1475,6 +1480,11 @@ fec_drv_remove(struct platform_device *pdev)
1475 iounmap((void __iomem *)ndev->base_addr); 1480 iounmap((void __iomem *)ndev->base_addr);
1476 unregister_netdev(ndev); 1481 unregister_netdev(ndev);
1477 free_netdev(ndev); 1482 free_netdev(ndev);
1483
1484 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1485 BUG_ON(!r);
1486 release_mem_region(r->start, resource_size(r));
1487
1478 return 0; 1488 return 0;
1479} 1489}
1480 1490