Zero the GPIO regulator pins memory.
This fixes a panic in Espressobin when gpioregulator fails to allocate the GPIO pin (the GPIO controller is not there). Sponsored by: Rubicon Communications, LLC (Netgate)
This commit is contained in:
parent
806adc6c00
commit
e5b6bcc7d2
@ -248,7 +248,7 @@ gpioregulator_parse_fdt(struct gpioregulator_softc *sc)
|
||||
/* "gpios" property */
|
||||
sc->init_def.npins = 32 - __builtin_clz(mask);
|
||||
sc->init_def.pins = malloc(sc->init_def.npins *
|
||||
sizeof(sc->init_def.pins), M_DEVBUF, M_WAITOK);
|
||||
sizeof(sc->init_def.pins), M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
for (n = 0; n < sc->init_def.npins; n++) {
|
||||
error = gpio_pin_get_by_ofw_idx(sc->dev, node, n,
|
||||
&sc->init_def.pins[n]);
|
||||
|
Loading…
Reference in New Issue
Block a user