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-v6.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux

Pull gpio fix from Bartosz Golaszewski:

- fix a buggy get_direction() retval check

* tag 'gpio-fixes-for-v6.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
gpiolib: Fix Oops in gpiod_direction_input_nonotify()

+10 -10
+10 -10
drivers/gpio/gpiolib.c
··· 2712 2712 2713 2713 int gpiod_direction_input_nonotify(struct gpio_desc *desc) 2714 2714 { 2715 - int ret = 0; 2715 + int ret = 0, dir; 2716 2716 2717 2717 CLASS(gpio_chip_guard, guard)(desc); 2718 2718 if (!guard.gc) ··· 2740 2740 ret = guard.gc->direction_input(guard.gc, 2741 2741 gpio_chip_hwgpio(desc)); 2742 2742 } else if (guard.gc->get_direction) { 2743 - ret = guard.gc->get_direction(guard.gc, 2743 + dir = guard.gc->get_direction(guard.gc, 2744 2744 gpio_chip_hwgpio(desc)); 2745 - if (ret < 0) 2746 - return ret; 2745 + if (dir < 0) 2746 + return dir; 2747 2747 2748 - if (ret != GPIO_LINE_DIRECTION_IN) { 2748 + if (dir != GPIO_LINE_DIRECTION_IN) { 2749 2749 gpiod_warn(desc, 2750 2750 "%s: missing direction_input() operation and line is output\n", 2751 2751 __func__); ··· 2764 2764 2765 2765 static int gpiod_direction_output_raw_commit(struct gpio_desc *desc, int value) 2766 2766 { 2767 - int val = !!value, ret = 0; 2767 + int val = !!value, ret = 0, dir; 2768 2768 2769 2769 CLASS(gpio_chip_guard, guard)(desc); 2770 2770 if (!guard.gc) ··· 2788 2788 } else { 2789 2789 /* Check that we are in output mode if we can */ 2790 2790 if (guard.gc->get_direction) { 2791 - ret = guard.gc->get_direction(guard.gc, 2791 + dir = guard.gc->get_direction(guard.gc, 2792 2792 gpio_chip_hwgpio(desc)); 2793 - if (ret < 0) 2794 - return ret; 2793 + if (dir < 0) 2794 + return dir; 2795 2795 2796 - if (ret != GPIO_LINE_DIRECTION_OUT) { 2796 + if (dir != GPIO_LINE_DIRECTION_OUT) { 2797 2797 gpiod_warn(desc, 2798 2798 "%s: missing direction_output() operation\n", 2799 2799 __func__);