mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
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
This commit is contained in:
@@ -748,14 +748,14 @@ static bool gpio_shared_entry_is_really_shared(struct gpio_shared_entry *entry)
|
||||
static void gpio_shared_free_exclusive(void)
|
||||
{
|
||||
struct gpio_shared_entry *entry, *epos;
|
||||
struct gpio_shared_ref *ref, *rpos;
|
||||
|
||||
list_for_each_entry_safe(entry, epos, &gpio_shared_list, list) {
|
||||
if (gpio_shared_entry_is_really_shared(entry))
|
||||
continue;
|
||||
|
||||
gpio_shared_drop_ref(list_first_entry(&entry->refs,
|
||||
struct gpio_shared_ref,
|
||||
list));
|
||||
list_for_each_entry_safe(ref, rpos, &entry->refs, list)
|
||||
gpio_shared_drop_ref(ref);
|
||||
gpio_shared_drop_entry(entry);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3267,8 +3267,12 @@ static int gpiochip_get(struct gpio_chip *gc, unsigned int offset)
|
||||
|
||||
/* Make sure this is called after checking for gc->get(). */
|
||||
ret = gc->get(gc, offset);
|
||||
if (ret > 1)
|
||||
ret = -EBADE;
|
||||
if (ret > 1) {
|
||||
gpiochip_warn(gc,
|
||||
"invalid return value from gc->get(): %d, consider fixing the driver\n",
|
||||
ret);
|
||||
ret = !!ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user