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=1796386376; b=lRxjasmPOZ3Vwqn/RKojtdctif3EYqhSnWEkOCJbrZNUM5tw2L2ZB04A4cJaliCouGtN qYwKLexwd/E+KcOC+SS/xMbPC4/bR96LbNFLtvjV/Z/hJqof+jNJEVrduOrdYDPkxivXL P84tzgw3a6Bdo2sz+RiKB7ltGDiovu8x37oVmiQC2VGwPQhddqXF6PdRRWx1oj5TaQlCf B8rcAfCEQcQHMCgwZMGSgr3mwAlt5xmeTtvNgONSzAm6m+2kLRlkONOit14cGe5uqArxR QOsIQkqYixLC/HJEuGeUCodl97+mxOgmjVXoJAH+bq2SJqNy/qKN0qScscoRqvR+Eaw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386376; 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=CagHX1q1v4JbSg48s+i6Y/xqU4yUu59zoWbLZGDBEpM=; b=01Q5mV9Jvg4VsEwN4rZAk6U89n4qAkjgeoTpvMQ6AIZSel6W3KP+0Hl/zOtXD/nk8Tj1 n23+UrnFrR/xJ4RhCiLaXT4I4i3aLfaDQ5bp3IrXIU2Co+PwRqSxqfNI7/25E15Y0295Z lt/7yWvH901eoXatY0prn6LJLT1OijSHQOPlK3G4wnfXwuqvc5SvE4tVV7ExJNO5Zyz4F Zn6w8dAnHokL5wnzUMmyyEBLpLQE+Bn1IDA/UMxOiXdWsYZFEj0KHYlG2P47sn6coWku5 1o9o6HnxquszkgoH8tzdGG16MPvD5XlfL2195+NGfPOr+/0W3iUH41kbhm/ylO6n3Mg== 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=formLcJz; 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 BC5C9606A32C; Fri, 4 Dec 2026 12:12:56 +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=formLcJz Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12E381F00939; Fri, 4 Dec 2026 12:12:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796386376; bh=CagHX1q1v4JbSg48s+i6Y/xqU4yUu59zoWbLZGDBEpM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=formLcJzsl80LSOt7ts7q6lb77Pf8wKaS5uAtSChCWRSQdmEi/SJV6KYjZ3RGhxt/ sA3HLvSet3UbIWwauqcoOfwQTtV2YRQ9mCKZsABH5CiwBivZZ9lA+SLrC44XYcvgxA BXPRaI9yUh05Gi8FMT0suvdB6h7hurCtTohq4Y1I= 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.6 0934/1167] tools: gpio: Preserve device listing errors in lsgpio Date: Fri, 4 Dec 2026 19:06:01 +0900 Message-ID: <20261204100726.520526837@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: 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.6-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