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=1796384590; b=hR4QL8ZCrjYT7emOJKldmvZYMjoyaNwQ4fe6cW9Ydsb+cZHbaoWuGxWf/OYBC2Z3n9a3 73C2gpoUzgNggWaH8AMnBZEB2tfLDMbA8DOHV7tcMK5H1u16OsHGr64j31EPvFNt+mr6K ZXi1o686okLZUbSmqj5NBNpkYX877trH09RyTCvT48wfoepHwHH/HwbDgnd1PdrTdqe8F BeTN8X8ng/AYatptdmRFpduBxHNpJEwvxE0l87PmgdW+SSReThGhMk3oCPQtx/mivaHC0 fGZFyCP/iDGwC/5YdsjsKoGP8pMv1V6FJpryFaqGtiXnVNMdwrwHiOQ3vn/Ab8Eug9g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384590; 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=fo2mHngYhib4p0KLO83i0kTgLebIgvEwE+Od2/hfXpg=; b=ct0MMUQzbPUCqytyL/z+zdTp0TXpwjk/tnhEb7KSaoTXNWnJPcyqupY7MXG8PY0LCvrd WfAq3IndNwr1alaEDbIFNkw5NohoqL3Oj9NJhVw1kLWwK8qsrkZAi7F1uCTa/WJaRapYh XqkiTTLhEPF30wetdu9LEYyRARnknbZ7jJMgV6ZJR84xMDpguMCKK4rt/usje+ngwPtpU 1jVfNSwT9NeXa/EFhSoccLlfim2wdAi8uudyHpVVu8HiYVwCsogQhVZUHTMQrzMABGYkv LDJD5PkQ3j7yQmf26GBXVff/Dnu17oOUVk6ZYoYm34eXMNtxH+YHGQcUmwEtCR0Knkg== 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=QW5Ivz7K; 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 DD0EE606A322; Fri, 4 Dec 2026 11:43:10 +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=QW5Ivz7K Received: by smtp.kernel.org (Postfix) with ESMTPSA id B28931F000C2; Fri, 4 Dec 2026 11:43:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384590; bh=fo2mHngYhib4p0KLO83i0kTgLebIgvEwE+Od2/hfXpg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QW5Ivz7KoHXlv8YQN3Gue+yDZran+UtJa1wWLuQKFwKaNR76sBbR68qZz6GLbNSRt WMU4xds+MW6OqtzMavmX+zsJnj9XcBs8x1vD/0EJPJmOkUVLqUcQNihqnd7bO4hscf GljEgnz5y0ScI3XLfL0VnL+2281QAj0OpIVYNuzE= 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.6 0214/1167] gpiolib: of: return -ENOENT from of_gpio_count() stub Date: Fri, 4 Dec 2026 18:54:01 +0900 Message-ID: <20261204100707.646591435@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-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 6b3a5347c5d92..12937d843097a 100644 --- a/drivers/gpio/gpiolib-of.h +++ b/drivers/gpio/gpiolib-of.h @@ -34,7 +34,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; } #endif /* CONFIG_OF_GPIO */ -- 2.53.0