Skip to content

Commit

Permalink
Merge tag 'gpio-v4.1-3' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…git/linusw/linux-gpio

Pull GPIO fixes from Linus Walleij:
 "Here are two GPIO fixes targeted for stable:

   - a leak in gpiochip_add path destined for stable

   - a kempld driver bug destined for stable"

* tag 'gpio-v4.1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
  gpio: gpio-kempld: Fix get_direction return value
  gpio: fix gpio leak in gpiochip_add error path
  • Loading branch information
Linus Torvalds committed May 25, 2015
2 parents ba155e2 + f230e8f commit e7db38a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-kempld.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static int kempld_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
= container_of(chip, struct kempld_gpio_data, chip);
struct kempld_device_data *pld = gpio->pld;

return kempld_gpio_get_bit(pld, KEMPLD_GPIO_DIR_NUM(offset), offset);
return !kempld_gpio_get_bit(pld, KEMPLD_GPIO_DIR_NUM(offset), offset);
}

static int kempld_gpio_pincount(struct kempld_device_data *pld)
Expand Down
10 changes: 6 additions & 4 deletions drivers/gpio/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ static DEFINE_MUTEX(gpio_lookup_lock);
static LIST_HEAD(gpio_lookup_list);
LIST_HEAD(gpio_chips);


static void gpiochip_free_hogs(struct gpio_chip *chip);
static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip);


static inline void desc_set_label(struct gpio_desc *d, const char *label)
{
d->label = label;
Expand Down Expand Up @@ -297,6 +302,7 @@ int gpiochip_add(struct gpio_chip *chip)

err_remove_chip:
acpi_gpiochip_remove(chip);
gpiochip_free_hogs(chip);
of_gpiochip_remove(chip);
spin_lock_irqsave(&gpio_lock, flags);
list_del(&chip->list);
Expand All @@ -313,10 +319,6 @@ int gpiochip_add(struct gpio_chip *chip)
}
EXPORT_SYMBOL_GPL(gpiochip_add);

/* Forward-declaration */
static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip);
static void gpiochip_free_hogs(struct gpio_chip *chip);

/**
* gpiochip_remove() - unregister a gpio_chip
* @chip: the chip to unregister
Expand Down

0 comments on commit e7db38a

Please sign in to comment.