GPIO fixes for the v4.1 series:

- A leak in gpiochip_add path destined for stable.
 - A kempld driver bug destined for stable.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJVYs3lAAoJEEEQszewGV1zRl8P/0oTLGgfBNqFp7/TJ8KlfmjO
 FhIMpxL8XpKKvGNTfqw4mTWJ5sNntPPmOc9ohRQuavbZXgr25asbpeh72MpLAjcg
 Yb4LY46UeHr9bJdvYnmPag/D3hUPYWJS4LdleF8IhKm5oqfAhuyj6fOWIkpYQNOC
 IItVjej7hT/qsWxo3z1kjIWhTMhsT8PmOSygNPlCCOyMw2lAHlo2/hUHP12K2DYR
 mQ3MpVuJ4QZPdUo9GUWZSww5G7qSLppTZwsUHXvjUQKMB36p/ICTu7QzkzBMaaK4
 sCIOQHg4ppSeHZ2srZckwH0pXmNwyj6NxNUgUefQKcGZOqeQaImKHsZlcERm2Mh3
 vn7xOzjCa2IAUD2sMFoMz9Eb8r96TZANtrjStkEruiO/++F+xeOF9IY8zl9oYSC6
 q3HvUpMrM4fkWJYwfyvzSlAgdG5F3hdQ0Y9EJuHFVIlGTv3OQmUtVayTHLMk/6Bg
 sk5XM33SKGP3Lrb63zN8/sDCyG7jNtpMtAqy3B3Chm5CVA6kotdLV02fpycF5H+/
 Iec4seBRnvdYqeltW13hCy9gNA7ZuL4UmsmsvgADEdmfVsj61gMbFMRTz2nUQr06
 zwHjsr8PGIsFJmLXRfF236YM0w2oGTbsiIRQgr4yii4ffO7vnlne/jUE/wX1z50O
 Q0xXb4wZS3kVPTRoCbLz
 =6IvA
 -----END PGP SIGNATURE-----

Merge tag 'gpio-v4.1-3' of git://git.kernel.org/pub/scm/linux/kernel/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
This commit is contained in:
Linus Torvalds 2015-05-25 15:10:59 -07:00
commit e7db38a2ef
2 changed files with 7 additions and 5 deletions

View File

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

View File

@ -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;
@ -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);
@ -313,10 +319,6 @@ err_free_descs:
}
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