]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
gpiolib: remove redundant callback check
authorBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Fri, 9 Jan 2026 10:55:56 +0000 (11:55 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Mon, 12 Jan 2026 08:35:04 +0000 (09:35 +0100)
The presence of the .get_direction() callback is already checked in
gpiochip_get_direction(). Remove the duplicated check which also returns
the wrong error code to user-space.

Fixes: e623c4303ed1 ("gpiolib: sanitize the return value of gpio_chip::get_direction()")
Reported-by: Michael Walle <mwalle@kernel.org>
Closes: https://lore.kernel.org/all/DFJAFK3DTBOZ.3G2P3A5IH34GF@kernel.org/
Link: https://lore.kernel.org/r/20260109105557.20024-1-bartosz.golaszewski@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
drivers/gpio/gpiolib.c

index dcf427d3cf437ffe7c144c027e01235d499a92d3..fe2d107b0a844619072925f19e92da134ce950ec 100644 (file)
@@ -468,9 +468,6 @@ int gpiod_get_direction(struct gpio_desc *desc)
            test_bit(GPIOD_FLAG_IS_OUT, &flags))
                return 0;
 
-       if (!guard.gc->get_direction)
-               return -ENOTSUPP;
-
        ret = gpiochip_get_direction(guard.gc, offset);
        if (ret < 0)
                return ret;