diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index d081e02..67d771b 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -119,6 +119,7 @@ int gpio_request_one(unsigned gpio, unsigned long flags, const char *label) { int err; + struct gpio_info *gi = gpio_to_desc(gpio); /* * Not all of the flags below are mulit-bit, but, for the sake @@ -134,10 +135,7 @@ if (err) return err; - if (active_low) { - struct gpio_info *gi = gpio_to_desc(gpio); - gi->active_low = true; - } + gi->active_low = active_low; if (dir_in) err = gpio_direction_input(gpio); @@ -147,12 +145,8 @@ err = gpio_direction_output(gpio, init_high); if (err) - goto free_gpio; + gpio_free(gpio); - return 0; - - free_gpio: - gpio_free(gpio); return err; } EXPORT_SYMBOL_GPL(gpio_request_one);