From f058b6fbee728ac6b81fb37484d4f07675adcdc1 Mon Sep 17 00:00:00 2001 From: Oleksandr Tymoshenko Date: Thu, 12 May 2016 20:13:16 +0000 Subject: [PATCH] Properly release mapped pin in gpio_pin_release --- sys/dev/gpio/ofw_gpiobus.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/dev/gpio/ofw_gpiobus.c b/sys/dev/gpio/ofw_gpiobus.c index 4dfde93a7992..6a38cc11771d 100644 --- a/sys/dev/gpio/ofw_gpiobus.c +++ b/sys/dev/gpio/ofw_gpiobus.c @@ -139,10 +139,17 @@ gpio_pin_get_by_ofw_name(device_t consumer, phandle_t node, 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); }