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=1796380262; b=igzoRzWSv0wFf1/NyUzX5UQv3Yn1n3W+jctliIevk5UkeVx2xjyQDElBE+PdJhXZ7c6u g/l3iAaZrA8chYoMHWXVAHoppfdMoR7uozS5OK8eBO2nv2QswdyWJO4MJ0Rbv40lYZqk8 slv6l8Ut5c7O7cBGtlhQcRVr8PdAEhvWe6WFGZXT46NU/lxRfHEBDqM/0Kg0hlDu2baUz ymrea2j1w9lL8EfM08W3SDMWRflNCIle3dOWnPMgS1AKsJmRGmOpimLJYWemnu7DRvdSq o5S+DG9i20zdCV3I7MnLqRvnAJdDAl9ocXkAOf2avpIsW43UKbm33eQr0Hl+WCSqIVg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380262; 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=gcRe69QJ3XsqScXRs5RD3LugrLUq3ZdKTtenQLG+X4k=; b=gElRKba0u3uWEbtiSmVFYyxG38CH925eUC66d+GkJGS3iSWEycB+iQUJsvFnxCmVeowo c4FcXsci1luyd+ZcfwtQA97snLokCX3C0JuWXtTF1JE8oZAr9BspjsOtP5xn1DMi0vkHF M175LIa7sE6P/dDDrZPAr6k36E3Is9L1PYxhFxVYicBtWayUI3a8s/Jx3V6Kiwo9wCgaX 50MwAP2uZE5WLIA6UsYUqvXqSViUCC0GeJPFzLbVbdsZAPucCpC4+9ASsGsBmCm2eLelJ 5T/0XzhusBh706OIAfk874CotnFxZBJsUSA4eykeuzKFnRswAIdG/6Y+wcMY3NpvxCQ== 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=m7ZtfD3f; 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 2F441606A322; Fri, 4 Dec 2026 10:31:01 +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=m7ZtfD3f Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E4981F000CE; Fri, 4 Dec 2026 10:31:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380261; bh=gcRe69QJ3XsqScXRs5RD3LugrLUq3ZdKTtenQLG+X4k=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=m7ZtfD3fRW/X6oLTjGztNLizyHxKZuDCe39mq1UQ4qX6C65phYW8EBa0RBX/Y8hHQ twx3zX3CkkgxZQhj8X+inavZK24eTGGXGJFL3NdjPve2647am+DTpDAgJci8Mw/N+x ZcKO+Zf3rEW3CxjqDTHQmAMiPiMXdEhNWNzm0Ks8= 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 7.3 197/742] tools: gpio: Preserve device listing errors in lsgpio Date: Fri, 4 Dec 2026 19:01:01 +0900 Message-ID: <20261204100640.322865670@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@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 7.3-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