Properly release mapped pin in gpio_pin_release

This commit is contained in:
Oleksandr Tymoshenko 2016-05-12 20:13:16 +00:00
parent 3381a3898a
commit f058b6fbee

View File

@ -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);
}