Re: [PATCH v2 3/7] gpiolib: of: return -ENOENT from of_gpio_count() stub

From: Andy Shevchenko

Date: Wed Nov 04 2026 - 07:08:29 EST


On Tue, Nov 03, 2026 at 07:40:31PM -0800, Dmitry Torokhov wrote:
> gpiod_count() and its firmware backends are expected to return either a
> positive number of GPIOs or a negative error code (-ENOENT) when no
> GPIOs are assigned. However, the !CONFIG_OF_GPIO stub for
> of_gpio_count() returns 0 instead of -ENOENT. This causes gpiod_count()
> to skip the platform_gpio_count() fallback (which triggers when
> count < 0) and erroneously return 0 to callers.
>
> Change the stub to return -ENOENT to match the real of_gpio_count()
> implementation and the other error-returning stubs in gpiolib-of.h.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>

--
With Best Regards,
Andy Shevchenko