[PATCH v1] gpiolib: fix trace on missing gpiochip->get_direction callback

From: Frank Wunderlich

Date: Thu Apr 09 2026 - 09:41:25 EST


From: Frank Wunderlich <frank-w@xxxxxxxxxxxxxxx>

if gpio_chip.get_direction callback is not implemented (e.g. pinctrl-moore) there
is a bunch of traces because of this.

Just remove the WARN_ON to avoid traces and restore previous behaviour but keep the
sanitization active.

Fixes: 471e998c0e31 ("gpiolib: remove redundant callback check")
Fixes: e623c4303ed1 ("gpiolib: sanitize the return value of gpio_chip::get_direction()")
Signed-off-by: Frank Wunderlich <frank-w@xxxxxxxxxxxxxxx>
---
drivers/gpio/gpiolib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 86a171e96b0e..302cbd7989f3 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -420,7 +420,7 @@ static int gpiochip_get_direction(struct gpio_chip *gc, unsigned int offset)

lockdep_assert_held(&gc->gpiodev->srcu);

- if (WARN_ON(!gc->get_direction))
+ if (!gc->get_direction)
return -EOPNOTSUPP;

ret = gc->get_direction(gc, offset);
--
2.43.0