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

Oleksandr Tymoshenko gonzo at FreeBSD.org
Thu May 12 20:13:17 UTC 2016


Author: gonzo
Date: Thu May 12 20:13:16 2016
New Revision: 299564
URL: https://svnweb.freebsd.org/changeset/base/299564

Log:
  Properly release mapped pin in gpio_pin_release

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

Modified: head/sys/dev/gpio/ofw_gpiobus.c
==============================================================================
--- head/sys/dev/gpio/ofw_gpiobus.c	Thu May 12 20:12:45 2016	(r299563)
+++ head/sys/dev/gpio/ofw_gpiobus.c	Thu May 12 20:13:16 2016	(r299564)
@@ -139,10 +139,17 @@ gpio_pin_get_by_ofw_name(device_t consum
 void
 gpio_pin_release(gpio_pin_t gpio)
 {
+	device_t busdev;
 
 	if (gpio == NULL)
 		return;
 
+	KASSERT(gpio->dev != NULL, ("invalid pin state"));
+
+	busdev = GPIO_GET_BUS(gpio->dev);
+	if (busdev != NULL)
+		gpiobus_release_pin(busdev, gpio->pin);
+
 	/* XXXX Unreserve pin. */
 	free(gpio, M_DEVBUF);
 }


More information about the svn-src-head mailing list