From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796387239; b=Wgr3ra99xBK/WUoGwTHkz3uFtEOLOxdQY8ukJObFW/bZ6/mTtuZ4tdEGrmu6+5UQCZ/9 +Xd3UurztXLq2/UINUjpljCpg5gUFZD3Q/IyjsUaqwNGzDHoi0wXHZ+ulYBF+DZ9RhNwk wGlHVOtYlvxKTNISHUWmE3EFQJFdWuohSrlgBr6j9DXtxo6jZZVZtKdbo3tnLmFd/PeiN 9ZJzApAjk87+Yl9W/teFf+KYXMd6iuFjuBFRVuduaorZItc6V5o5zq6f2M5wRydZ9ET9e uG0mxB2FA+cF6tOvAJ17yrSsGRqi/CF6LYGmWskR0j5TDQ3x3+TFdRtto4EWiuiaatw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387239; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=lPiTdFpbFtSi2UPisO11rNTt0Ibe/L2dedo85DQ9zBE=; b=e3WEo9Qzxzh447yp6OW4bgf2OKrzoo9eL2XuULJ4xz75JJ/AHCDXezItG9FvHD3M9wrg BxoOniDy2TTAY0/hKde24rjksExLNuQTEUH05wbTocPKyNy3c5ncdjdhm/1IerJNhwUnM kvPHmVnF54AVnx8f1vhx+grLzvUc5xfm0SAL0ZA5K3ZotQ9XSbg00fG++xex1L4P/Dw+O yHGJv24AY2Z6c8vjwx+00/sxKjFZ1g/kSxy1c1497c7tINqhI65bw0ogdSzm3DC+XmtqO GQ1N1jYK5rw3ezVfpmIP90MrysGvvWClwfx3HOy9NvlWZmRCsXE2RfGh3HuX9v2oI0w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=OZrr1rXS; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 503A6606A322; Fri, 4 Dec 2026 12:27:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=OZrr1rXS Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67A761F000C2; Fri, 4 Dec 2026 12:27:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387238; bh=lPiTdFpbFtSi2UPisO11rNTt0Ibe/L2dedo85DQ9zBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=OZrr1rXS13OqGmQigF8UkRCmfwl7vFozgf+RhOksQA/s5buR4333niR0d5Z2/kXlC byloIqdCRa8PaLoyBUENzmJ+tP/5SSD6/TLou7BaKvlqfRBJB8ScWigmliZweQ4WHN b8AnGDZ4vwEf/GLZ6T4QxwM4FInysKi3BvR+Tkdc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Andy Shevchenko , Dmitry Torokhov , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 6.1 0162/1059] gpiolib: of: return -ENOENT from of_gpio_count() stub Date: Fri, 4 Dec 2026 18:54:53 +0900 Message-ID: <20261204100648.421186199@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Torokhov [ Upstream commit e20e4b8cda2b4d7dd32dbd2c0875a15d92545f04 ] 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. Fixes: f626d6dfb709 ("gpio: of: Break out OF-only code") Reviewed-by: Andy Shevchenko Signed-off-by: Dmitry Torokhov Link: https://patch.msgid.link/20261105-b4-gpiolib-free-v3-3-bb47ad58642d@gmail.com Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin --- drivers/gpio/gpiolib-of.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib-of.h b/drivers/gpio/gpiolib-of.h index 8af2bc899aab2..9cab0194554eb 100644 --- a/drivers/gpio/gpiolib-of.h +++ b/drivers/gpio/gpiolib-of.h @@ -28,7 +28,7 @@ static inline int of_gpiochip_add(struct gpio_chip *gc) { return 0; } static inline void of_gpiochip_remove(struct gpio_chip *gc) { } static inline int of_gpio_get_count(struct device *dev, const char *con_id) { - return 0; + return -ENOENT; } static inline bool of_gpio_need_valid_mask(const struct gpio_chip *gc) { -- 2.53.0