aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJonas Bonn <jonas@southpole.se>2010-06-10 22:47:40 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-11 16:28:37 -0400
commita71fba97295db924c0b90266e9833e5059fead24 (patch)
treed6be811cf4910167ed83fdfb2bdcd51d0c7bf0fd /drivers
parentb46773db64c264a6600f58d9da1ae43708b47fda (diff)
ethoc: use devres resource management
The point of using the devres resource management routines is that they simplify the driver by taking care of releasing resources on failure and release. A recent commit added a bunch of error handling that is unnecessary in this context. This patch removes this redundant error handling, as well as using dmam_alloc_coherent in place of dma_alloc_coherent in order to use this framework consistenly throughout the driver. Signed-off-by: Jonas Bonn <jonas@southpole.se> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethoc.c28
1 files changed, 1 insertions, 27 deletions
diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
index 1681f081ff6f..37ce8aca2cc6 100644
--- a/drivers/net/ethoc.c
+++ b/drivers/net/ethoc.c
@@ -964,7 +964,7 @@ static int ethoc_probe(struct platform_device *pdev)
964 } 964 }
965 } else { 965 } else {
966 /* Allocate buffer memory */ 966 /* Allocate buffer memory */
967 priv->membase = dma_alloc_coherent(NULL, 967 priv->membase = dmam_alloc_coherent(&pdev->dev,
968 buffer_size, (void *)&netdev->mem_start, 968 buffer_size, (void *)&netdev->mem_start,
969 GFP_KERNEL); 969 GFP_KERNEL);
970 if (!priv->membase) { 970 if (!priv->membase) {
@@ -1074,21 +1074,6 @@ free_mdio:
1074 kfree(priv->mdio->irq); 1074 kfree(priv->mdio->irq);
1075 mdiobus_free(priv->mdio); 1075 mdiobus_free(priv->mdio);
1076free: 1076free:
1077 if (priv) {
1078 if (priv->dma_alloc)
1079 dma_free_coherent(NULL, priv->dma_alloc, priv->membase,
1080 netdev->mem_start);
1081 else if (priv->membase)
1082 devm_iounmap(&pdev->dev, priv->membase);
1083 if (priv->iobase)
1084 devm_iounmap(&pdev->dev, priv->iobase);
1085 }
1086 if (mem)
1087 devm_release_mem_region(&pdev->dev, mem->start,
1088 mem->end - mem->start + 1);
1089 if (mmio)
1090 devm_release_mem_region(&pdev->dev, mmio->start,
1091 mmio->end - mmio->start + 1);
1092 free_netdev(netdev); 1077 free_netdev(netdev);
1093out: 1078out:
1094 return ret; 1079 return ret;
@@ -1115,17 +1100,6 @@ static int ethoc_remove(struct platform_device *pdev)
1115 kfree(priv->mdio->irq); 1100 kfree(priv->mdio->irq);
1116 mdiobus_free(priv->mdio); 1101 mdiobus_free(priv->mdio);
1117 } 1102 }
1118 if (priv->dma_alloc)
1119 dma_free_coherent(NULL, priv->dma_alloc, priv->membase,
1120 netdev->mem_start);
1121 else {
1122 devm_iounmap(&pdev->dev, priv->membase);
1123 devm_release_mem_region(&pdev->dev, netdev->mem_start,
1124 netdev->mem_end - netdev->mem_start + 1);
1125 }
1126 devm_iounmap(&pdev->dev, priv->iobase);
1127 devm_release_mem_region(&pdev->dev, netdev->base_addr,
1128 priv->io_region_size);
1129 unregister_netdev(netdev); 1103 unregister_netdev(netdev);
1130 free_netdev(netdev); 1104 free_netdev(netdev);
1131 } 1105 }