{"id":2216035,"url":"http://patchwork.ozlabs.org/api/patches/2216035/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20260325165431.1027591-12-sjg@chromium.org/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260325165431.1027591-12-sjg@chromium.org>","list_archive_url":null,"date":"2026-03-25T16:54:20","name":"[11/13] boot: Move setting the OS arch into check_allowed()","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"1d1ec69810772a756175155db44bd38e1239537e","submitter":{"id":6170,"url":"http://patchwork.ozlabs.org/api/people/6170/?format=json","name":"Simon Glass","email":"sjg@chromium.org"},"delegate":{"id":3651,"url":"http://patchwork.ozlabs.org/api/users/3651/?format=json","username":"trini","first_name":"Tom","last_name":"Rini","email":"trini@ti.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20260325165431.1027591-12-sjg@chromium.org/mbox/","series":[{"id":497475,"url":"http://patchwork.ozlabs.org/api/series/497475/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=497475","date":"2026-03-25T16:54:09","name":"boot: Make fit_image_load() easier to maintain","version":1,"mbox":"http://patchwork.ozlabs.org/series/497475/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2216035/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2216035/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256\n header.s=google header.b=X/ctBrxU;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=85.214.62.61; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)","phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=chromium.org","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=chromium.org header.i=@chromium.org\n header.b=\"X/ctBrxU\";\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=chromium.org","phobos.denx.de;\n spf=pass smtp.mailfrom=sjg@chromium.org"],"Received":["from phobos.denx.de (phobos.denx.de [85.214.62.61])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fgtPB5QVmz1yG1\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 26 Mar 2026 03:57:18 +1100 (AEDT)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id C04BD84090;\n\tWed, 25 Mar 2026 17:55:58 +0100 (CET)","by phobos.denx.de (Postfix, from userid 109)\n id 618F28408D; Wed, 25 Mar 2026 17:55:57 +0100 (CET)","from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com\n [IPv6:2607:f8b0:4864:20::22a])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 34BF083F14\n for <u-boot@lists.denx.de>; Wed, 25 Mar 2026 17:55:55 +0100 (CET)","by mail-oi1-x22a.google.com with SMTP id\n 5614622812f47-46805c4ae5dso4048b6e.1\n for <u-boot@lists.denx.de>; Wed, 25 Mar 2026 09:55:55 -0700 (PDT)","from chromium.org ([73.34.74.121]) by smtp.gmail.com with ESMTPSA id\n 5614622812f47-46a7099df08sm30481b6e.15.2026.03.25.09.55.50\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 25 Mar 2026 09:55:51 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,\n DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,\n RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham\n autolearn_force=no version=3.4.2","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=chromium.org; s=google; t=1774457753; x=1775062553; darn=lists.denx.de;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=/X8linunaJh7FOP64XGfe4iHFWg4bjSahyn53q0yEfQ=;\n b=X/ctBrxUWLUcn+0mmwgDMoK0ho28JFdgLs4aalInFCe86it8oG0qVzNhneHbcS21vt\n R+VAmCvpjG+VOAmf/WstYQKYLeCx5UcUsw+i9McKF9ooif3LDBFx2AeEjDknyl91ZM14\n TzrxyLY2n4p8OqALy56Dh6Ec0hPD9uCUkvde0=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774457753; x=1775062553;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=/X8linunaJh7FOP64XGfe4iHFWg4bjSahyn53q0yEfQ=;\n b=FHbDffVmIL3hhFP0imSWdv835S9vhLcxMZ8BMPwrJeTqxJ8JalLikGLsjOCgi/nxV7\n O+MpUkhciqLYJkHOIBDPJHDCoTJlEElCmA7bayYWMKdNXtxgr0+TeP+5kl6LqEp/0NHM\n ifjQ/PV6w674QA4O+L2l1GrVCYwE/iux2ey5g+OPma6agIGZPJc+TW+idxpVQXA/IfrF\n 4ntRLfzsXinMuo2BfmxsNLcrxxJibKIywiMw5gXb3x2hYNXKY1KhbhPNjJOxXXCpj+gr\n 9qcPb7I5/GyZz0jBrFk9yOW9c1ysSXRYTwFz8Za+Pnx5gWQLvEZC4KpJp5I1ZWLfww1R\n iaMg==","X-Gm-Message-State":"AOJu0YztYndqTlr3sQrSAXF8UUKjOIMCGBnUeEB6c1thy2LSpqIVanHp\n MuR4zYJlfDxSoGehRQeQEdW6MuFnMdfRf3VUS+sx796iBVzbqBTu0DxQC4lZnZgaVmm2+nOuMu7\n XuuSSKA==","X-Gm-Gg":"ATEYQzzu2E/PyPQB+v5XDQ9PSwetb3YTJyXfi0ZQQTLNO4uJTJi0W+bl6Do+PyGRa1M\n jJEwjakCwHe5a0/hXXeneGyWOPTAo5GFgLd/fdlYlua6P3QrZG+0Ob5kRovFOfJH+8l0KhxGtXT\n 9AzwbIMLKt2AqDlWWs1AmHpDYVxBTLXXZ64ty/qREm9BU4eHFsd0K29YDW3uD7EvEQ8CPTEHTsW\n ksxQIZs8IEKKk9mNAcjTrY4a+WQr+pLTVLN5kVT8tr/pvi3Y8nSYOJN8rOYYBA+MjzCIhwY13Hx\n b6ICfH37fa7mUDcK9Yl3IIALYbziWoKmGC0Pdk/aIjQ1Gnhi042yIEnK+h74YEzuA1ggRE4LiF4\n P5C8USTxKTLUhXMFgmuvMkW+WmnQnUnJeqFLWlgAmF/U7EV/0vgSfwMgtSXtshhMG6x8l5UTq0u\n o9WCqNYk+Vrgmx9nNfTQ==","X-Received":"by 2002:a05:6808:23cc:b0:467:f636:23bd with SMTP id\n 5614622812f47-46a5c7448f7mr2004293b6e.42.1774457753357;\n Wed, 25 Mar 2026 09:55:53 -0700 (PDT)","From":"Simon Glass <sjg@chromium.org>","To":"u-boot@lists.denx.de","Cc":"Simon Glass <sjg@chromium.org>,\n James Hilliard <james.hilliard1@gmail.com>,\n Marek Vasut <marek.vasut+renesas@mailbox.org>,\n Quentin Schulz <quentin.schulz@cherry.de>, Tom Rini <trini@konsulko.com>","Subject":"[PATCH 11/13] boot: Move setting the OS arch into check_allowed()","Date":"Wed, 25 Mar 2026 10:54:20 -0600","Message-ID":"<20260325165431.1027591-12-sjg@chromium.org>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20260325165431.1027591-1-sjg@chromium.org>","References":"<20260325165431.1027591-1-sjg@chromium.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.8 at phobos.denx.de","X-Virus-Status":"Clean"},"content":"Remove a few more lines from fit_image_load() by dealing with this small\ndetail in check_allowed().\n\nSigned-off-by: Simon Glass <sjg@chromium.org>\n---\n\n boot/image-fit.c | 14 ++++++++------\n 1 file changed, 8 insertions(+), 6 deletions(-)","diff":"diff --git a/boot/image-fit.c b/boot/image-fit.c\nindex 7efd0f30dc5..749cbe19ade 100644\n--- a/boot/image-fit.c\n+++ b/boot/image-fit.c\n@@ -2182,17 +2182,19 @@ static int select_image(const void *fit, struct bootm_headers *images,\n  *\n  * @fit: FIT to check\n  * @noffset: Node offset of the image being loaded\n+ * @images: Boot images structure\n  * @image_type: Type of the image\n  * @arch: Expected architecture for the image\n  * @bootstage_id: ID of starting bootstage to use for progress updates\n  * Return: 0 if OK, -EIO if not\n  */\n static int check_allowed(const void *fit, int noffset,\n+\t\t\t struct bootm_headers *images,\n \t\t\t enum image_type_t image_type, enum image_arch_t arch,\n \t\t\t int bootstage_id)\n {\n \tbool type_ok, os_ok;\n-\tuint8_t os;\n+\tuint8_t os, os_arch;\n \n \tbootstage_mark(bootstage_id + BOOTSTAGE_SUB_CHECK_ARCH);\n \tif (!tools_build() && IS_ENABLED(CONFIG_SANDBOX)) {\n@@ -2238,6 +2240,9 @@ static int check_allowed(const void *fit, int noffset,\n \n \tbootstage_mark(bootstage_id + BOOTSTAGE_SUB_CHECK_ALL_OK);\n \n+\tfit_image_get_arch(fit, noffset, &os_arch);\n+\timages_set_arch(images, os_arch);\n+\n \treturn 0;\n }\n \n@@ -2476,7 +2481,6 @@ int fit_image_load(struct bootm_headers *images, ulong addr,\n \tconst void *fit;\n \tvoid *buf;\n \tulong load, data, len;\n-\tuint8_t os_arch;\n \tconst char *prop_name;\n \tint ret;\n \n@@ -2493,13 +2497,11 @@ int fit_image_load(struct bootm_headers *images, ulong addr,\n \tif (noffset < 0)\n \t\treturn noffset;\n \n-\tret = check_allowed(fit, noffset, image_type, arch, bootstage_id);\n+\tret = check_allowed(fit, noffset, images, image_type, arch,\n+\t\t\t    bootstage_id);\n \tif (ret)\n \t\treturn ret;\n \n-\tfit_image_get_arch(fit, noffset, &os_arch);\n-\timages_set_arch(images, os_arch);\n-\n \tret = obtain_data(fit, noffset, prop_name, bootstage_id, &buf, &len);\n \tif (ret)\n \t\treturn ret;\n","prefixes":["11/13"]}