From patchwork Sun Mar 22 23:57:01 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2035 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1774223865; bh=9YChFVi6y1HbAPoffKX9Nwk7Yc03CspRzyoDhiHY5xo=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Nxmm5ukqxp7ZHnASYrrE/RfXOKrnMXCjtwtwa5UzOzvh+bvDS6Q9dmoYIvml+nJ93 Cglz7CRDkcMMTEVDmZLprhmV0UfcCd5nZaEXLD2AMNGVgkj5H8h0lFUQeeH4g0k9yl OO5QLPju0sUxjXM1XrNfNuF1RP7E7qT0nR9/Dn6J19kyW5OksDdVhc24J1EovaZR4G vUQKFyfeV1rTQ0S+BYnwU87h7KNV5jQ7MuEjLZ+LJ0zwqNKphzFglkGra+Q8uXCwr2 y+b+i4ZCdXNf9qqcMRZTusViYWPWfoQkzt2JAvMYFfKPt9aCcURDcST9jUh2x0l5DE KwFfcEybulcTw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7812D6A1E4 for ; Sun, 22 Mar 2026 17:57:45 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 7mRSW1YZmq2P for ; Sun, 22 Mar 2026 17:57:45 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1774223865; bh=9YChFVi6y1HbAPoffKX9Nwk7Yc03CspRzyoDhiHY5xo=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Nxmm5ukqxp7ZHnASYrrE/RfXOKrnMXCjtwtwa5UzOzvh+bvDS6Q9dmoYIvml+nJ93 Cglz7CRDkcMMTEVDmZLprhmV0UfcCd5nZaEXLD2AMNGVgkj5H8h0lFUQeeH4g0k9yl OO5QLPju0sUxjXM1XrNfNuF1RP7E7qT0nR9/Dn6J19kyW5OksDdVhc24J1EovaZR4G vUQKFyfeV1rTQ0S+BYnwU87h7KNV5jQ7MuEjLZ+LJ0zwqNKphzFglkGra+Q8uXCwr2 y+b+i4ZCdXNf9qqcMRZTusViYWPWfoQkzt2JAvMYFfKPt9aCcURDcST9jUh2x0l5DE KwFfcEybulcTw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 610316A1E2 for ; Sun, 22 Mar 2026 17:57:45 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1774223858; bh=gU9MUgDNApfFF7FI7TkaN4okQ17185YtEczf6oQ9Uw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w3Cs1By8BTO3LdW3cBRJltgfZ9Y8kHQXWIwCjFDxpOVISvpMReLgLUvXyZlG0Ufif H9IQv124wMdsiPpydOYCbYASLbeTyzBlfJ26f6zReNWYBAWK4iiiOONjsR0/03yztC iHNmqQ3k3y1Q9La3+9WGzGx7OK1LmQvQage0W2VK2IUflMSKrbOV8he6bqHlId55WW htrtHhSDLkTOqUAMDcKLu2J9HIBQyaQhtpAQiOj53/xxzSR85ASzwvVbbFijM0sxyC YCLBue7U9+4daSCqd8fO6IL/0HW05zfWap/ckxnb/CCzCnNEJOecWQgPDyg2+0ps/Y LSj3WhlEzizIQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6B96366F0C; Sun, 22 Mar 2026 17:57:38 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id NC5Ui2wQ957I; Sun, 22 Mar 2026 17:57:38 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1774223858; bh=pjbPIcMMXLeiUT8bWFjCQxAg87ug0GGLghWxmSgod6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o7DaocerFX2voJ9UQ3os8WcfwcskRZR0NtWZhIGSEU250LqQW3I1yIpkfh48lesSa 5JmwPUU0YnuDa6NZpPd2Bg2CEg+hHQk55K15uSK6qKMJUfVEcfSAugtxVD1ppN1eqB Xd4yOD4Cgxh84JDxxeXuPOZGzbncpb9sR5Rp8YYiWONwIOI8t78WD0LXnpQ8AwWnji m2qiwfD+UlnLJysYE4j2l5j/REupHz+nGBEozzWBT3HwL5uZ02d2NXAHdJ45KjT9BF 8alk6JR09lipFkVoySoQL809fEDxc2h3kT7z7Q5NVcISIvrWKbbH5Gr4ZL/s04VPQn 3xUXlBnMvZYMw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id CC3346A1D7; Sun, 22 Mar 2026 17:57:37 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Sun, 22 Mar 2026 17:57:01 -0600 Message-ID: <20260322235719.1729267-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260322235719.1729267-1-sjg@u-boot.org> References: <20260322235719.1729267-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: MZ3NDQ4TPG3YVJPPM2NLBGGREMELVO4Z X-Message-ID-Hash: MZ3NDQ4TPG3YVJPPM2NLBGGREMELVO4Z X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 03/14] bootstd: Set iter->err before BOOTFLOWIF_ALL early return List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass In bootflow_scan_first(), iter->err is not set before the BOOTFLOWIF_ALL early return, leaving it at its initial value of 0. This is inconsistent with bootflow_scan_next() which sets iter->err before the same early return. Move the iter->err assignment before the BOOTFLOWIF_ALL check so that subsequent calls to iter_incr() can correctly see the error from the previous iteration. Fixes: 5033e36637af ("bootstd: Add support for bootflows") Signed-off-by: Simon Glass --- boot/bootflow.c | 2 +- test/boot/bootflow.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/boot/bootflow.c b/boot/bootflow.c index befe507af96..a8a73ee0c7f 100644 --- a/boot/bootflow.c +++ b/boot/bootflow.c @@ -655,11 +655,11 @@ int bootflow_scan_first(struct udevice *dev, const char *label, ret = bootflow_check(iter, bflow); if (ret) { log_debug("check - ret=%d\n", ret); + iter->err = ret; if (ret != BF_NO_MORE_PARTS && ret != -ENOSYS) { if (iter->flags & BOOTFLOWIF_ALL) return log_msg_ret("all", ret); } - iter->err = ret; bootflow_free(bflow); ret = bootflow_scan_next(iter, bflow); if (ret) diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index 6c84a264bff..5ecb5f557b1 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -321,6 +321,7 @@ static int bootflow_iter(struct unit_test_state *uts) ut_asserteq(0, iter.max_part); ut_asserteq_str("extlinux", iter.method->name); ut_asserteq(0, bflow.err); + ut_asserteq(-EPROTONOSUPPORT, iter.err); ut_assert(!iter.doing_global); ut_assert(!iter.have_global); ut_asserteq(-1, iter.first_glob_method);