summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut+renesas@gmail.com>2017-11-09 22:49:19 +0100
committerMarek Vasut <marek.vasut+renesas@gmail.com>2017-11-30 02:32:34 +0100
commit90997cda7614bc1a751b107ae292f725ab161b25 (patch)
treed0bca742828f8c3c10c1fdef8311e2091a1a0176 /drivers/net
parent9e75ea46d50886187cd418168330745c1e1faf3f (diff)
net: ravb: Fix reset GPIO handling
Fix handling of the reset GPIO. Drop the _nodev() suffix from the gpio_request_by_name() call as there is now a proper DM capable GPIO driver. Also check if the GPIO is valid before freeing it in remove path, otherwise U-Boot will crash. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ravb.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/ravb.c b/drivers/net/ravb.c
index dc7a52534e..26d95f178f 100644
--- a/drivers/net/ravb.c
+++ b/drivers/net/ravb.c
@@ -492,8 +492,8 @@ static int ravb_probe(struct udevice *dev)
if (ret < 0)
goto err_mdio_alloc;
- gpio_request_by_name_nodev(dev_ofnode(dev), "reset-gpios", 0,
- &eth->reset_gpio, GPIOD_IS_OUT);
+ gpio_request_by_name(dev, "reset-gpios", 0, &eth->reset_gpio,
+ GPIOD_IS_OUT);
mdiodev = mdio_alloc();
if (!mdiodev) {
@@ -528,7 +528,8 @@ static int ravb_remove(struct udevice *dev)
free(eth->phydev);
mdio_unregister(eth->bus);
mdio_free(eth->bus);
- dm_gpio_free(dev, &eth->reset_gpio);
+ if (dm_gpio_is_valid(&eth->reset_gpio))
+ dm_gpio_free(dev, &eth->reset_gpio);
unmap_physmem(eth->iobase, MAP_NOCACHE);
return 0;