aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/renesas
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2014-03-20 10:00:31 -0400
committerDavid S. Miller <davem@davemloft.net>2014-03-20 17:22:08 -0400
commitaa8d422510969b705656e49fc0166d862aca9246 (patch)
treed68b69f0975055df6b1b299939e1b7faa78d7b77 /drivers/net/ethernet/renesas
parent54af36e7136b5e111734ca5b06c6b4390d663cac (diff)
sh_eth: Use the platform device for memory allocation
Memory allocated for the MDIO bus with the devm_kzalloc() API is associated with the network device. While this will cause memory to be freed at the right time, it doesn't allow allocating memory before the network device is initialized. Replace the network device with the parent platform device for memory allocation to remove that dependency. This also improves consistency with the other devm_* calls in the driver that all use the platform device. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/renesas')
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index efaca6d5e85b..f669e2aac9bd 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -2606,10 +2606,10 @@ static int sh_mdio_init(struct net_device *ndev, int id,
2606 int ret, i; 2606 int ret, i;
2607 struct bb_info *bitbang; 2607 struct bb_info *bitbang;
2608 struct sh_eth_private *mdp = netdev_priv(ndev); 2608 struct sh_eth_private *mdp = netdev_priv(ndev);
2609 struct device *dev = &mdp->pdev->dev;
2609 2610
2610 /* create bit control struct for PHY */ 2611 /* create bit control struct for PHY */
2611 bitbang = devm_kzalloc(&ndev->dev, sizeof(struct bb_info), 2612 bitbang = devm_kzalloc(dev, sizeof(struct bb_info), GFP_KERNEL);
2612 GFP_KERNEL);
2613 if (!bitbang) { 2613 if (!bitbang) {
2614 ret = -ENOMEM; 2614 ret = -ENOMEM;
2615 goto out; 2615 goto out;
@@ -2638,8 +2638,7 @@ static int sh_mdio_init(struct net_device *ndev, int id,
2638 mdp->pdev->name, id); 2638 mdp->pdev->name, id);
2639 2639
2640 /* PHY IRQ */ 2640 /* PHY IRQ */
2641 mdp->mii_bus->irq = devm_kzalloc(&ndev->dev, 2641 mdp->mii_bus->irq = devm_kzalloc(dev, sizeof(int) * PHY_MAX_ADDR,
2642 sizeof(int) * PHY_MAX_ADDR,
2643 GFP_KERNEL); 2642 GFP_KERNEL);
2644 if (!mdp->mii_bus->irq) { 2643 if (!mdp->mii_bus->irq) {
2645 ret = -ENOMEM; 2644 ret = -ENOMEM;