svn commit: r348759 - head/sys/dev/gpio

Luiz Otavio O Souza loos at FreeBSD.org
Thu Jun 6 20:54:11 UTC 2019


Author: loos
Date: Thu Jun  6 20:54:09 2019
New Revision: 348759
URL: https://svnweb.freebsd.org/changeset/base/348759

Log:
  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)

Modified:
  head/sys/dev/gpio/gpioregulator.c

Modified: head/sys/dev/gpio/gpioregulator.c
==============================================================================
--- head/sys/dev/gpio/gpioregulator.c	Thu Jun  6 20:35:41 2019	(r348758)
+++ head/sys/dev/gpio/gpioregulator.c	Thu Jun  6 20:54:09 2019	(r348759)
@@ -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]);


More information about the svn-src-all mailing list