Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'gpio-fixes-for-v7.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux

Pull gpio fixes from Bartosz Golaszewski:

- fix memory leaks in shared GPIO management

- normalize the return values of gpio_chip::get() in GPIO core on
behalf of drivers that return invalid values (this is done because
adding stricter sanitization of callback retvals led to breakages in
existing users, we'll revert that once all are fixed)

* tag 'gpio-fixes-for-v7.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
gpiolib: normalize the return value of gc->get() on behalf of buggy drivers
gpio: shared: fix memory leaks

+9 -5
+3 -3
drivers/gpio/gpiolib-shared.c
··· 748 748 static void gpio_shared_free_exclusive(void) 749 749 { 750 750 struct gpio_shared_entry *entry, *epos; 751 + struct gpio_shared_ref *ref, *rpos; 751 752 752 753 list_for_each_entry_safe(entry, epos, &gpio_shared_list, list) { 753 754 if (gpio_shared_entry_is_really_shared(entry)) 754 755 continue; 755 756 756 - gpio_shared_drop_ref(list_first_entry(&entry->refs, 757 - struct gpio_shared_ref, 758 - list)); 757 + list_for_each_entry_safe(ref, rpos, &entry->refs, list) 758 + gpio_shared_drop_ref(ref); 759 759 gpio_shared_drop_entry(entry); 760 760 } 761 761 }
+6 -2
drivers/gpio/gpiolib.c
··· 3267 3267 3268 3268 /* Make sure this is called after checking for gc->get(). */ 3269 3269 ret = gc->get(gc, offset); 3270 - if (ret > 1) 3271 - ret = -EBADE; 3270 + if (ret > 1) { 3271 + gpiochip_warn(gc, 3272 + "invalid return value from gc->get(): %d, consider fixing the driver\n", 3273 + ret); 3274 + ret = !!ret; 3275 + } 3272 3276 3273 3277 return ret; 3274 3278 }