From ee2c73e559e04e3e2b7c62c0ae86712c65ca8310 Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Sat, 7 Jan 2017 22:55:23 +0000 Subject: [PATCH] Only write to *active once, even when GPIO_ACTIVE_LOW is set. --- sys/dev/gpio/ofw_gpiobus.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/dev/gpio/ofw_gpiobus.c b/sys/dev/gpio/ofw_gpiobus.c index f8fcbea9507..1f98d7cad2a 100644 --- a/sys/dev/gpio/ofw_gpiobus.c +++ b/sys/dev/gpio/ofw_gpiobus.c @@ -178,9 +178,10 @@ gpio_pin_is_active(gpio_pin_t pin, bool *active) return (rv); } - *active = tmp != 0; if (pin->flags & GPIO_ACTIVE_LOW) - *active = !(*active); + *active = tmp == 0; + else + *active = tmp != 0; return (0); }