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=1796383480; b=5s1KW58tuB/d9PGrDSFejQSb1p7N01cbz1F8OFyh/wPN0Je0zOhFBnPN6MDJIy9GAiQR kiIGuy4HtARCKx3CkhvUEcg0QfkJE6kV1apWKwNlmgZwYyB+LXsq8n8poCbc34OdW6DEP HDx8pFyNj0ukzMVBRknbSAK9HhzDFQby4G8FfXOe9dDURjnjjfXKZfDcWDejKImE6I9GP xHAxjMulYUJe2xhpRcYqO2OuZ0VBLXQ9dDniNegGfJhXCk2EQ87jfW1sZBrYoGCKdqnV5 7kxB3ghpQloSklLVAdS3vxl3TklmNr/qKRvuDXIASoIauZ46jlzFjMIl0O1THUSDxTQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383480; 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=NhC7AEkO+fj2akBQSWTnyxTzUGCbxXh5egkAxrPUEWY=; b=b2W242218gq4klmmMkJMv0wFFs4NJGqkde0w/k2ur7gaY7GZh4l2+rlTvmfJOTciqUyO Q97CcCvdWwkPxWE2SsJLNT53QWubDnz0fqAHO7SUhr63wAW0uOQBFZbCO6ZGi0S3efAFy bBjOZvvnfvXWDi5+TTKGqcSJtHt5YUr2P8/imlBx1hvSg33wwkBlDz++Htv3Fio+rvPPQ 5AROf7DQ9pEbbqBK9z9RD61OixdXSIb9DyTlN6DMTBIFUYq0HBcmjXD4fgUNyzVqbD6Np +uDUFIu6hodtgdie/OL7aMs1UtuZNw8PdyVg+SEiuJ0nz/Y1QaBIqb1tT9JIgnZCtBg== 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="ESPcLY/C"; 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 84A7F606A337; Fri, 4 Dec 2026 11:24:40 +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=ESPcLY/C Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2F751F00937; Fri, 4 Dec 2026 11:24:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383480; bh=NhC7AEkO+fj2akBQSWTnyxTzUGCbxXh5egkAxrPUEWY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ESPcLY/Cw2XpO9DCAvUgC6xBnzZMWsWf2rNj/ExMAiw+nJeJTTZpHp0zbtfTvPGES MU0ilI524H/fj4FyeDHh8AGKML2LsBbByY8iD2xWnDxapbIaIeA8zqsb9tEHhhBB31 1cKsqpM3BsXSe7QYXCUashp0P/ksQ7odc5QK+L3g= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zhu Jun , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 6.12 242/555] tools: gpio: Preserve device listing errors in lsgpio Date: Fri, 4 Dec 2026 19:04:45 +0900 Message-ID: <20261204100618.409359263@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@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.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhu Jun [ Upstream commit 809117fc28453aafa7164ad45ea853f900974d08 ] When no chip is selected, lsgpio breaks out of the directory scan on a list_device() failure, then unconditionally resets ret to zero. A chip that cannot be opened or queried is therefore reported as success. Initialize ret to zero before scanning instead, so an empty scan still succeeds and errors from list_device() reach the caller. Fixes: 6d591c46bce0 ("tools/gpio: create GPIO tools") Signed-off-by: Zhu Jun Link: https://patch.msgid.link/20261120062053.98356-1-zhujun2@cmss.chinamobile.com Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin --- tools/gpio/lsgpio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/gpio/lsgpio.c b/tools/gpio/lsgpio.c index 52a0be45410c9..de2eccc134796 100644 --- a/tools/gpio/lsgpio.c +++ b/tools/gpio/lsgpio.c @@ -205,7 +205,7 @@ int main(int argc, char **argv) goto error_out; } - ret = -ENOENT; + ret = 0; while (ent = readdir(dp), ent) { if (check_prefix(ent->d_name, "gpiochip")) { ret = list_device(ent->d_name); @@ -214,7 +214,6 @@ int main(int argc, char **argv) } } - ret = 0; if (closedir(dp) == -1) { perror("scanning devices: Failed to close directory"); ret = -errno; -- 2.53.0