Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2216025/?format=api
{ "id": 2216025, "url": "http://patchwork.ozlabs.org/api/patches/2216025/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20260325165431.1027591-2-sjg@chromium.org/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api", "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-2-sjg@chromium.org>", "list_archive_url": null, "date": "2026-03-25T16:54:10", "name": "[01/13] boot: Split out the first part of fit_image_load()", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "672f6cd8b904f616e979add880ef24217b32f3c3", "submitter": { "id": 6170, "url": "http://patchwork.ozlabs.org/api/people/6170/?format=api", "name": "Simon Glass", "email": "sjg@chromium.org" }, "delegate": { "id": 3651, "url": "http://patchwork.ozlabs.org/api/users/3651/?format=api", "username": "trini", "first_name": "Tom", "last_name": "Rini", "email": "trini@ti.com" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20260325165431.1027591-2-sjg@chromium.org/mbox/", "series": [ { "id": 497475, "url": "http://patchwork.ozlabs.org/api/series/497475/?format=api", "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/2216025/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2216025/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=n4c9Ghmz;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; 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=\"n4c9Ghmz\";\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\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\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 4fgtMP2X59z1y1K\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 26 Mar 2026 03:55:45 +1100 (AEDT)", "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id A5AD983CE3;\n\tWed, 25 Mar 2026 17:55:37 +0100 (CET)", "by phobos.denx.de (Postfix, from userid 109)\n id 3FC7F83E76; Wed, 25 Mar 2026 17:55:36 +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 F37AA81E18\n for <u-boot@lists.denx.de>; Wed, 25 Mar 2026 17:55:33 +0100 (CET)", "by mail-oi1-x22a.google.com with SMTP id\n 5614622812f47-46703fb602fso7135b6e.0\n for <u-boot@lists.denx.de>; Wed, 25 Mar 2026 09:55:33 -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.30\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 25 Mar 2026 09:55:31 -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=1774457732; x=1775062532; 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=Djx79y6zim88x1Lcr8YbHp2Jm2cLlYmn4DoS4o2rY0o=;\n b=n4c9GhmztVdEE13T22jK0Ep70ZIsZqjKHzo1p1BAWfxv3ZKYNfmd3zw0tRxtf+JvRR\n 3lqFmCopSdLTrTYgYrm/Ki2Wv5IIlpG9eMhjYyT/N7oYro82X+RCk9vw+MvIR5/LIrD2\n LtGdO9A4XKiBHG8/5aA0nCRRdwEmmURwSl8Zc=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774457732; x=1775062532;\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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05:6808:1928:b0:466:f60b:19c5 with SMTP id\n 5614622812f47-46a5c57af7emr2006481b6e.6.1774457732085;\n Wed, 25 Mar 2026 09:55:32 -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 01/13] boot: Split out the first part of fit_image_load()", "Date": "Wed, 25 Mar 2026 10:54:10 -0600", "Message-ID": "<20260325165431.1027591-2-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": "This function is over 250 lines long. Split out the image-selection\npart into a new select_image() function which handles format checking,\nconfiguration selection and image-node lookup.\n\nTake care to only call fit_get_name() when a valid node is found, since\nlibfdt does not handle negative offsets gracefully.\n\nSigned-off-by: Simon Glass <sjg@chromium.org>\n---\n\n boot/image-fit.c | 101 ++++++++++++++++++++++++++++++++---------------\n 1 file changed, 70 insertions(+), 31 deletions(-)", "diff": "diff --git a/boot/image-fit.c b/boot/image-fit.c\nindex e7c7212195f..a4402dcff63 100644\n--- a/boot/image-fit.c\n+++ b/boot/image-fit.c\n@@ -2070,33 +2070,35 @@ static const char *fit_get_image_type_property(int ph_type)\n \treturn \"unknown\";\n }\n \n-int fit_image_load(struct bootm_headers *images, ulong addr,\n-\t\t const char **fit_unamep, const char **fit_uname_configp,\n-\t\t int arch, int ph_type, int bootstage_id,\n-\t\t enum fit_load_op load_op, ulong *datap, ulong *lenp)\n+/**\n+ * select_image() - Select the image to load\n+ *\n+ * image->fit_uname_cfg is set if the image type is IH_TYPE_KERNEL\n+ *\n+ * @fit: Pointer to FIT\n+ * @images: Boot images structure\n+ * @fit_unamep: On entry, the requested image name (e.g. \"kernel\") or NULL to\n+ * use the default. On exit, the selected image name\n+ * @fit_uname_config: Requested configuration name (e.g. \"conf-1\") or NULL to\n+ * use the default\n+ * @prop_name: Property name (in the configuration node) indicating the image\n+ * to load\n+ * @ph_type: Required image type (IH_TYPE_...) and phase (IH_PHASE_...)\n+ * @bootstage_id: ID of starting bootstage to use for progress updates\n+ * @fit_base_uname_configp: Returns config name selected, or NULL if *fit_unamep\n+ * was used to select an image node\n+ * Return: node offset of image node, on success, else -ve error code\n+ */\n+static int select_image(const void *fit, struct bootm_headers *images,\n+\t\t\tconst char **fit_unamep, const char *fit_uname_config,\n+\t\t\tconst char *prop_name, int ph_type, int bootstage_id,\n+\t\t\tconst char **fit_base_uname_configp)\n {\n-\tint image_type = image_ph_type(ph_type);\n \tint cfg_noffset, noffset;\n-\tconst char *fit_uname;\n-\tconst char *fit_uname_config;\n-\tconst char *fit_base_uname_config;\n-\tconst void *fit;\n-\tvoid *buf;\n-\tvoid *loadbuf;\n-\tsize_t size;\n-\tint type_ok, os_ok;\n-\tulong load, load_end, data, len;\n-\tuint8_t os, comp;\n-\tconst char *prop_name;\n \tint ret;\n \n-\tfit = map_sysmem(addr, 0);\n-\tfit_uname = fit_unamep ? *fit_unamep : NULL;\n-\tfit_uname_config = fit_uname_configp ? *fit_uname_configp : NULL;\n-\tfit_base_uname_config = NULL;\n+\t*fit_base_uname_configp = NULL;\n \tprop_name = fit_get_image_type_property(ph_type);\n-\tprintf(\"## Loading %s (%s) from FIT Image at %08lx ...\\n\",\n-\t prop_name, genimg_get_phase_name(image_ph_phase(ph_type)), addr);\n \n \tbootstage_mark(bootstage_id + BOOTSTAGE_SUB_FORMAT);\n \tret = fit_check_format(fit, IMAGE_SIZE_INVAL);\n@@ -2108,10 +2110,10 @@ int fit_image_load(struct bootm_headers *images, ulong addr,\n \t\treturn ret;\n \t}\n \tbootstage_mark(bootstage_id + BOOTSTAGE_SUB_FORMAT_OK);\n-\tif (fit_uname) {\n+\tif (*fit_unamep) {\n \t\t/* get FIT component image node offset */\n \t\tbootstage_mark(bootstage_id + BOOTSTAGE_SUB_UNIT_NAME);\n-\t\tnoffset = fit_image_get_node(fit, fit_uname);\n+\t\tnoffset = fit_image_get_node(fit, *fit_unamep);\n \t} else {\n \t\t/*\n \t\t * no image node unit name, try to get config\n@@ -2133,11 +2135,12 @@ int fit_image_load(struct bootm_headers *images, ulong addr,\n \t\t}\n \t\tcfg_noffset = ret;\n \n-\t\tfit_base_uname_config = fdt_get_name(fit, cfg_noffset, NULL);\n-\t\tprintf(\" Using '%s' configuration\\n\", fit_base_uname_config);\n+\t\t*fit_base_uname_configp = fdt_get_name(fit, cfg_noffset, NULL);\n+\t\tprintf(\" Using '%s' configuration\\n\",\n+\t\t *fit_base_uname_configp);\n \t\t/* Remember this config */\n-\t\tif (image_type == IH_TYPE_KERNEL)\n-\t\t\timages->fit_uname_cfg = fit_base_uname_config;\n+\t\tif (image_ph_type(ph_type) == IH_TYPE_KERNEL)\n+\t\t\timages->fit_uname_cfg = *fit_base_uname_configp;\n \n \t\tif (FIT_IMAGE_ENABLE_VERIFY && images->verify) {\n \t\t\tputs(\" Verifying Hash Integrity ... \");\n@@ -2161,10 +2164,46 @@ int fit_image_load(struct bootm_headers *images, ulong addr,\n \t\treturn -ENOENT;\n \t}\n \n-\tif (!fit_uname)\n-\t\tfit_uname = fit_get_name(fit, noffset, NULL);\n+\tif (!*fit_unamep)\n+\t\t*fit_unamep = fit_get_name(fit, noffset, NULL);\n+\n+\tprintf(\" Trying '%s' %s subimage\\n\", *fit_unamep, prop_name);\n+\n+\treturn noffset;\n+}\n+\n+int fit_image_load(struct bootm_headers *images, ulong addr,\n+\t\t const char **fit_unamep, const char **fit_uname_configp,\n+\t\t int arch, int ph_type, int bootstage_id,\n+\t\t enum fit_load_op load_op, ulong *datap, ulong *lenp)\n+{\n+\tint image_type = image_ph_type(ph_type);\n+\tint noffset;\n+\tconst char *fit_uname;\n+\tconst char *fit_uname_config;\n+\tconst char *fit_base_uname_config;\n+\tconst void *fit;\n+\tvoid *buf;\n+\tvoid *loadbuf;\n+\tsize_t size;\n+\tint type_ok, os_ok;\n+\tulong load, load_end, data, len;\n+\tuint8_t os, comp;\n+\tconst char *prop_name;\n+\tint ret;\n+\n+\tfit = map_sysmem(addr, 0);\n+\tprop_name = fit_get_image_type_property(ph_type);\n+\tprintf(\"## Loading %s (%s) from FIT Image at %08lx ...\\n\",\n+\t prop_name, genimg_get_phase_name(image_ph_phase(ph_type)), addr);\n \n-\tprintf(\" Trying '%s' %s subimage\\n\", fit_uname, prop_name);\n+\tfit_uname = fit_unamep ? *fit_unamep : NULL;\n+\tfit_uname_config = fit_uname_configp ? *fit_uname_configp : NULL;\n+\tnoffset = select_image(fit, images, &fit_uname, fit_uname_config,\n+\t\t\t prop_name, ph_type, bootstage_id,\n+\t\t\t &fit_base_uname_config);\n+\tif (noffset < 0)\n+\t\treturn noffset;\n \n \tret = fit_image_select(fit, noffset, images->verify);\n \tif (ret) {\n", "prefixes": [ "01/13" ] }