aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/cadence
diff options
context:
space:
mode:
authorSoren Brinkmann <soren.brinkmann@xilinx.com>2013-12-10 19:07:21 -0500
committerDavid S. Miller <davem@davemloft.net>2013-12-10 22:56:23 -0500
commit60fe716f005a0add0447796c38821b22ef379856 (patch)
tree3c25d4c4be23f894f95b6dd4382a3f966c493240 /drivers/net/ethernet/cadence
parentb48e0bab142fdfa16b52fc63f43acf0784c80ee7 (diff)
net: macb: Use devm_ioremap()
Use the device managed version of ioremap to remap IO memory, simplifying error paths. Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/cadence')
-rw-r--r--drivers/net/ethernet/cadence/macb.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 62aa136889a4..436aecc31732 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -17,6 +17,7 @@
17#include <linux/circ_buf.h> 17#include <linux/circ_buf.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/io.h>
20#include <linux/gpio.h> 21#include <linux/gpio.h>
21#include <linux/interrupt.h> 22#include <linux/interrupt.h>
22#include <linux/netdevice.h> 23#include <linux/netdevice.h>
@@ -1816,7 +1817,7 @@ static int __init macb_probe(struct platform_device *pdev)
1816 goto err_out_disable_pclk; 1817 goto err_out_disable_pclk;
1817 } 1818 }
1818 1819
1819 bp->regs = ioremap(regs->start, resource_size(regs)); 1820 bp->regs = devm_ioremap(&pdev->dev, regs->start, resource_size(regs));
1820 if (!bp->regs) { 1821 if (!bp->regs) {
1821 dev_err(&pdev->dev, "failed to map registers, aborting.\n"); 1822 dev_err(&pdev->dev, "failed to map registers, aborting.\n");
1822 err = -ENOMEM; 1823 err = -ENOMEM;
@@ -1828,7 +1829,7 @@ static int __init macb_probe(struct platform_device *pdev)
1828 if (err) { 1829 if (err) {
1829 dev_err(&pdev->dev, "Unable to request IRQ %d (error %d)\n", 1830 dev_err(&pdev->dev, "Unable to request IRQ %d (error %d)\n",
1830 dev->irq, err); 1831 dev->irq, err);
1831 goto err_out_iounmap; 1832 goto err_out_disable_clocks;
1832 } 1833 }
1833 1834
1834 dev->netdev_ops = &macb_netdev_ops; 1835 dev->netdev_ops = &macb_netdev_ops;
@@ -1916,8 +1917,6 @@ err_out_unregister_netdev:
1916 unregister_netdev(dev); 1917 unregister_netdev(dev);
1917err_out_free_irq: 1918err_out_free_irq:
1918 free_irq(dev->irq, dev); 1919 free_irq(dev->irq, dev);
1919err_out_iounmap:
1920 iounmap(bp->regs);
1921err_out_disable_clocks: 1920err_out_disable_clocks:
1922 clk_disable_unprepare(bp->hclk); 1921 clk_disable_unprepare(bp->hclk);
1923err_out_disable_pclk: 1922err_out_disable_pclk:
@@ -1944,7 +1943,6 @@ static int __exit macb_remove(struct platform_device *pdev)
1944 mdiobus_free(bp->mii_bus); 1943 mdiobus_free(bp->mii_bus);
1945 unregister_netdev(dev); 1944 unregister_netdev(dev);
1946 free_irq(dev->irq, dev); 1945 free_irq(dev->irq, dev);
1947 iounmap(bp->regs);
1948 clk_disable_unprepare(bp->hclk); 1946 clk_disable_unprepare(bp->hclk);
1949 clk_disable_unprepare(bp->pclk); 1947 clk_disable_unprepare(bp->pclk);
1950 free_netdev(dev); 1948 free_netdev(dev);