diff options
author | Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> | 2017-06-12 22:55:39 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-06-13 18:56:42 +0200 |
commit | fe0e4052fb11d5c713961ab7e136520be40052a3 (patch) | |
tree | 60dbcae8697b5c2fc821c8bc2e12b93a64f5db3a /drivers/net/phy/mdio_bus.c | |
parent | mdio_bus: handle only single PHY reset GPIO (diff) | |
download | linux-fe0e4052fb11d5c713961ab7e136520be40052a3.tar.xz linux-fe0e4052fb11d5c713961ab7e136520be40052a3.zip |
mdio_bus: use devm_gpiod_get_optional()
The MDIO reset GPIO is really a classical optional GPIO property case,
so devm_gpiod_get_optional() should have been used, not devm_gpiod_get().
Doing this saves several LoCs...
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/mdio_bus.c')
-rw-r--r-- | drivers/net/phy/mdio_bus.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 5d37716e7796..2df7b62c1a36 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -354,16 +354,12 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) mutex_init(&bus->mdio_lock); /* de-assert bus level PHY GPIO reset */ - gpiod = devm_gpiod_get(&bus->dev, "reset", GPIOD_OUT_LOW); + gpiod = devm_gpiod_get_optional(&bus->dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(gpiod)) { - err = PTR_ERR(gpiod); - if (err != -ENOENT) { - dev_err(&bus->dev, - "mii_bus %s couldn't get reset GPIO\n", - bus->id); - return err; - } - } else { + dev_err(&bus->dev, "mii_bus %s couldn't get reset GPIO\n", + bus->id); + return PTR_ERR(gpiod); + } else if (gpiod) { bus->reset_gpiod = gpiod; gpiod_set_value_cansleep(gpiod, 1); |