Skip to content

Commit

Permalink
Revert "mdio_bus: Remove unneeded gpiod NULL check"
Browse files Browse the repository at this point in the history
This reverts commit 95b80bf ("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: 95b80bf ("mdio_bus: Remove unneeded gpiod NULL check")
Reported-by: Woojung Huh <[email protected]>
Signed-off-by: Florian Fainelli <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
ffainelli authored and davem330 committed Sep 9, 2017
1 parent a7bc577 commit a010a2f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/net/phy/mdio_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,8 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
}

/* Put PHYs in RESET to save power */
gpiod_set_value_cansleep(bus->reset_gpiod, 1);
if (bus->reset_gpiod)
gpiod_set_value_cansleep(bus->reset_gpiod, 1);

device_del(&bus->dev);
return err;
Expand All @@ -424,7 +425,8 @@ void mdiobus_unregister(struct mii_bus *bus)
}

/* Put PHYs in RESET to save power */
gpiod_set_value_cansleep(bus->reset_gpiod, 1);
if (bus->reset_gpiod)
gpiod_set_value_cansleep(bus->reset_gpiod, 1);

device_del(&bus->dev);
}
Expand Down

0 comments on commit a010a2f

Please sign in to comment.