gpiopower: Fix call to ofw_gpiobus_parse_gpios

Failure is denoted by -1, not non-zero.  A positive integer denotes the
number of pins mapped and configured.
This commit is contained in:
Justin Hibbits 2022-04-27 16:55:28 -05:00
parent 00a80538b4
commit de6353ad8f

View file

@ -74,7 +74,7 @@ gpiopower_attach(device_t dev)
if ((node = ofw_bus_get_node(dev)) == -1)
return (ENXIO);
if (ofw_gpiobus_parse_gpios(dev, "gpios", &sc->sc_pin) != 0) {
if (ofw_gpiobus_parse_gpios(dev, "gpios", &sc->sc_pin) <= 0) {
device_printf(dev, "failed to map GPIO pin\n");
return (ENXIO);
}