diff options
author | Lennert Buytenhek <buytenh@marvell.com> | 2008-10-08 19:29:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-10-08 19:29:57 -0400 |
commit | 298cf9beb9679522de995e249eccbd82f7c51999 (patch) | |
tree | cabbc9c696a063982aea9a24d8caa667daa33a1a /drivers/net/phy/mdio-ofgpio.c | |
parent | 18ee49ddb0d242ed1d0e273038d5e4f6de7379d3 (diff) |
phylib: move to dynamic allocation of struct mii_bus
This patch introduces mdiobus_alloc() and mdiobus_free(), and
makes all mdio bus drivers use these functions to allocate their
struct mii_bus'es dynamically.
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Andy Fleming <afleming@freescale.com>
Diffstat (limited to 'drivers/net/phy/mdio-ofgpio.c')
-rw-r--r-- | drivers/net/phy/mdio-ofgpio.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/net/phy/mdio-ofgpio.c b/drivers/net/phy/mdio-ofgpio.c index 27bd4539d089..2ff97754e574 100644 --- a/drivers/net/phy/mdio-ofgpio.c +++ b/drivers/net/phy/mdio-ofgpio.c | |||
@@ -122,7 +122,7 @@ static int __devinit mdio_ofgpio_probe(struct of_device *ofdev, | |||
122 | 122 | ||
123 | new_bus = alloc_mdio_bitbang(&bitbang->ctrl); | 123 | new_bus = alloc_mdio_bitbang(&bitbang->ctrl); |
124 | if (!new_bus) | 124 | if (!new_bus) |
125 | goto out_free_priv; | 125 | goto out_free_bitbang; |
126 | 126 | ||
127 | new_bus->name = "GPIO Bitbanged MII", | 127 | new_bus->name = "GPIO Bitbanged MII", |
128 | 128 | ||
@@ -155,9 +155,9 @@ out_free_irqs: | |||
155 | dev_set_drvdata(&ofdev->dev, NULL); | 155 | dev_set_drvdata(&ofdev->dev, NULL); |
156 | kfree(new_bus->irq); | 156 | kfree(new_bus->irq); |
157 | out_free_bus: | 157 | out_free_bus: |
158 | kfree(new_bus); | ||
159 | out_free_priv: | ||
160 | free_mdio_bitbang(new_bus); | 158 | free_mdio_bitbang(new_bus); |
159 | out_free_bitbang: | ||
160 | kfree(bitbang); | ||
161 | out: | 161 | out: |
162 | return ret; | 162 | return ret; |
163 | } | 163 | } |
@@ -168,11 +168,10 @@ static int mdio_ofgpio_remove(struct of_device *ofdev) | |||
168 | struct mdio_gpio_info *bitbang = bus->priv; | 168 | struct mdio_gpio_info *bitbang = bus->priv; |
169 | 169 | ||
170 | mdiobus_unregister(bus); | 170 | mdiobus_unregister(bus); |
171 | kfree(bus->irq); | ||
171 | free_mdio_bitbang(bus); | 172 | free_mdio_bitbang(bus); |
172 | dev_set_drvdata(&ofdev->dev, NULL); | 173 | dev_set_drvdata(&ofdev->dev, NULL); |
173 | kfree(bus->irq); | ||
174 | kfree(bitbang); | 174 | kfree(bitbang); |
175 | kfree(bus); | ||
176 | 175 | ||
177 | return 0; | 176 | return 0; |
178 | } | 177 | } |