Commit 471e998c authored by Bartosz Golaszewski's avatar Bartosz Golaszewski
Browse files

gpiolib: remove redundant callback check



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: e623c430 ("gpiolib: sanitize the return value of gpio_chip::get_direction()")
Reported-by: default avatarMichael 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: default avatarBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
parent c1879001
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -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;