diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2017-09-08 18:38:07 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-09-09 00:12:40 -0400 |
commit | a010a2f6540ecc39f8701c6f7d35e22992c03fb6 (patch) | |
tree | 5970aa0631cfc54234919178951142220bb36d24 | |
parent | a7bc57749f231dcd5fdbc7b653bc260064caf0b9 (diff) |
Revert "mdio_bus: Remove unneeded gpiod NULL check"
This reverts commit 95b80bf3db03c2bf572a357cf74b9a6aefef0a4a ("mdio_bus:
Remove unneeded gpiod NULL check"), this commit assumed that GPIOLIB
checks for NULL descriptors, so it's safe to drop them, but it is not
when CONFIG_GPIOLIB is disabled in the kernel. If we do call
gpiod_set_value_cansleep() on a GPIO descriptor we will issue warnings
coming from the inline stubs declared in include/linux/gpio/consumer.h.
Fixes: 95b80bf3db03 ("mdio_bus: Remove unneeded gpiod NULL check")
Reported-by: Woojung Huh <Woojung.Huh@microchip.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/phy/mdio_bus.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index b6f9fa670168..2df7b62c1a36 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c | |||
@@ -399,7 +399,8 @@ error: | |||
399 | } | 399 | } |
400 | 400 | ||
401 | /* Put PHYs in RESET to save power */ | 401 | /* Put PHYs in RESET to save power */ |
402 | gpiod_set_value_cansleep(bus->reset_gpiod, 1); | 402 | if (bus->reset_gpiod) |
403 | gpiod_set_value_cansleep(bus->reset_gpiod, 1); | ||
403 | 404 | ||
404 | device_del(&bus->dev); | 405 | device_del(&bus->dev); |
405 | return err; | 406 | return err; |
@@ -424,7 +425,8 @@ void mdiobus_unregister(struct mii_bus *bus) | |||
424 | } | 425 | } |
425 | 426 | ||
426 | /* Put PHYs in RESET to save power */ | 427 | /* Put PHYs in RESET to save power */ |
427 | gpiod_set_value_cansleep(bus->reset_gpiod, 1); | 428 | if (bus->reset_gpiod) |
429 | gpiod_set_value_cansleep(bus->reset_gpiod, 1); | ||
428 | 430 | ||
429 | device_del(&bus->dev); | 431 | device_del(&bus->dev); |
430 | } | 432 | } |