Skip to content

Commit a010a2f

Browse files
ffainellidavem330
authored andcommitted
Revert "mdio_bus: Remove unneeded gpiod NULL check"
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 <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>
1 parent a7bc577 commit a010a2f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/net/phy/mdio_bus.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,8 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
399399
}
400400

401401
/* 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);
403404

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

426427
/* 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);
428430

429431
device_del(&bus->dev);
430432
}

0 commit comments

Comments
 (0)