aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>2013-04-10 19:29:34 -0400
committerDavid S. Miller <davem@davemloft.net>2013-04-11 16:19:39 -0400
commit727f957a3c24c97e228337e876c6c4b2733bdca3 (patch)
tree078c585cddcc26654410a054a5b1aad36fc489f8
parent209224862cabf7a871d680c448148ef6376bf98b (diff)
net: mv643xx_eth: use managed devm_kzalloc
This patch moves shared private data kzalloc to managed devm_kzalloc and cleans now unneccessary kfree and error handling. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/marvell/mv643xx_eth.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index bbe61041ddac..305038f48176 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -2547,25 +2547,22 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
2547 struct mv643xx_eth_shared_private *msp; 2547 struct mv643xx_eth_shared_private *msp;
2548 const struct mbus_dram_target_info *dram; 2548 const struct mbus_dram_target_info *dram;
2549 struct resource *res; 2549 struct resource *res;
2550 int ret;
2551 2550
2552 if (!mv643xx_eth_version_printed++) 2551 if (!mv643xx_eth_version_printed++)
2553 pr_notice("MV-643xx 10/100/1000 ethernet driver version %s\n", 2552 pr_notice("MV-643xx 10/100/1000 ethernet driver version %s\n",
2554 mv643xx_eth_driver_version); 2553 mv643xx_eth_driver_version);
2555 2554
2556 ret = -EINVAL;
2557 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 2555 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2558 if (res == NULL) 2556 if (res == NULL)
2559 goto out; 2557 return -EINVAL;
2560 2558
2561 ret = -ENOMEM; 2559 msp = devm_kzalloc(&pdev->dev, sizeof(*msp), GFP_KERNEL);
2562 msp = kzalloc(sizeof(*msp), GFP_KERNEL);
2563 if (msp == NULL) 2560 if (msp == NULL)
2564 goto out; 2561 return -ENOMEM;
2565 2562
2566 msp->base = ioremap(res->start, resource_size(res)); 2563 msp->base = ioremap(res->start, resource_size(res));
2567 if (msp->base == NULL) 2564 if (msp->base == NULL)
2568 goto out_free; 2565 return -ENOMEM;
2569 2566
2570 msp->clk = devm_clk_get(&pdev->dev, NULL); 2567 msp->clk = devm_clk_get(&pdev->dev, NULL);
2571 if (!IS_ERR(msp->clk)) 2568 if (!IS_ERR(msp->clk))
@@ -2585,11 +2582,6 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
2585 platform_set_drvdata(pdev, msp); 2582 platform_set_drvdata(pdev, msp);
2586 2583
2587 return 0; 2584 return 0;
2588
2589out_free:
2590 kfree(msp);
2591out:
2592 return ret;
2593} 2585}
2594 2586
2595static int mv643xx_eth_shared_remove(struct platform_device *pdev) 2587static int mv643xx_eth_shared_remove(struct platform_device *pdev)
@@ -2599,7 +2591,6 @@ static int mv643xx_eth_shared_remove(struct platform_device *pdev)
2599 iounmap(msp->base); 2591 iounmap(msp->base);
2600 if (!IS_ERR(msp->clk)) 2592 if (!IS_ERR(msp->clk))
2601 clk_disable_unprepare(msp->clk); 2593 clk_disable_unprepare(msp->clk);
2602 kfree(msp);
2603 2594
2604 return 0; 2595 return 0;
2605} 2596}