get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2216029/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2216029,
    "url": "http://patchwork.ozlabs.org/api/patches/2216029/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20260325165431.1027591-6-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-6-sjg@chromium.org>",
    "list_archive_url": null,
    "date": "2026-03-25T16:54:14",
    "name": "[05/13] boot: Move handling of the load_op into a separate function",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "6b365d71c31b6ad358be056ff7c85d754177947d",
    "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-6-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/2216029/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2216029/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=lfShIvsO;\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=\"lfShIvsO\";\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 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fgtN511psz1y1K\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 26 Mar 2026 03:56:21 +1100 (AEDT)",
            "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 094BA83F86;\n\tWed, 25 Mar 2026 17:55:48 +0100 (CET)",
            "by phobos.denx.de (Postfix, from userid 109)\n id B53B183FD3; Wed, 25 Mar 2026 17:55:45 +0100 (CET)",
            "from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com\n [IPv6:2607:f8b0:4864:20::22c])\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 5F57B83FA7\n for <u-boot@lists.denx.de>; Wed, 25 Mar 2026 17:55:43 +0100 (CET)",
            "by mail-oi1-x22c.google.com with SMTP id\n 5614622812f47-46701f2077cso924118b6e.0\n for <u-boot@lists.denx.de>; Wed, 25 Mar 2026 09:55:43 -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.39\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 25 Mar 2026 09:55:40 -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=1774457741; x=1775062541; 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=Z881z5jd2wmbjjcTKjYLqOLeDOI/44P3CyjiizKqpSo=;\n b=lfShIvsOH2CC1/V5bT/AXwDAi8tHlORPywd3aGuLQj3StxWNK9lRq4uPDUv3HaYTvb\n mfLhzFv82M6p1DL741j4b7AElhfBKLMSXgL4+1B52zrSogxEVdduYf4ruWV6QZlAh9T3\n slwUuX0eqGdiSU7E4wemNCKkeFXbrSmANq33g=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774457741; x=1775062541;\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=Z881z5jd2wmbjjcTKjYLqOLeDOI/44P3CyjiizKqpSo=;\n b=nlZSYnLAqwlbMiucnf/MPMGR39RHyMP5VOzjI4x3lVrLYcXuxkwRtGlBVCWrGeoobE\n caiX6xV0pdw18DhT7QqhHyX5ry09YTCEGvOK6WUQdVnhyqau3ddBwshbhb25WaW/yXWl\n PcByk6EDx2GdQeNnhfsSp21t0R8q9+SarG3LhE91GwLqx2x7LGknEpW2EkNwPkxrl/lA\n SeDiIYVruB6+q/kay1Gz48Gp5kAYPAUeWXivonOjj358U6lo13o8n2YmyNhjmiUkYWYo\n DCMBRX1XzvtR4kqR2PK1sx/nPMA7UPvCXwuKCQ2t2rdNW1qicQKfwu5qf+cTP7wGiRed\n 4O5Q==",
        "X-Gm-Message-State": "AOJu0YxRJFcuboZXwukjWukq2JerXxgYNa87OpdBpb/yHFfwRBxX/QnX\n xrdqQSg6HYA5Rasy3cu+sQNKZPILvFyHqSTFLAhI+9C4JtBW7ObXKGYi4KHCoufWlZMeLoOQLvX\n 1jlPFAg==",
        "X-Gm-Gg": "ATEYQzxz6LUz9XhKuPgnLTjNEihLAsNbm8q278CCNdn1Xa55QYXM28UEBxeUURLS4zK\n 0tG25a4pPWKp0DNSkOOT1Ao49MCPC6xvYBabUnCny6IQ/OVaW7I/PTxBSiNeF8PVOlkO47Rnes/\n X+i4FtRv+q5vI8O0RHPJux3PkdPhtuVdqB0jdqxHjob3nKoRrQo1nQ8A0Gvh7rlG43qYZ7JDXpI\n ce2MgAFwXOOD5VHOLq/BQbWGExnrkwjdhic9DIH4GT7279zBe3Ys7kZMG9Dp1EAx9T0d//layfJ\n nh3g5qtxJ1ay1thaQCS0PyX6n0mx1yN8sWGw1aeVtDYlY/akNlSMBc+LmMrfGxlEt2qlxgRh1cW\n BAnWoXbg/DWVTpQvbxWbQ6iPWtewY0mLoETEad6/BS2dmqFkBXqamAhxc6wNc60wj0asq2fJD0s\n xMgulJqmNuM6+Mk/ugJA==",
        "X-Received": "by 2002:a05:6808:1787:b0:467:153a:2d9c with SMTP id\n 5614622812f47-46a0cde406fmr4489674b6e.15.1774457741389;\n Wed, 25 Mar 2026 09:55:41 -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 05/13] boot: Move handling of the load_op into a separate\n function",
        "Date": "Wed, 25 Mar 2026 10:54:14 -0600",
        "Message-ID": "<20260325165431.1027591-6-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": "Since fit_image_load() is still too long, move the load-operation\nhandling into a separate function.\n\nSigned-off-by: Simon Glass <sjg@chromium.org>\n---\n\n boot/image-fit.c | 107 ++++++++++++++++++++++++++++++++---------------\n 1 file changed, 73 insertions(+), 34 deletions(-)",
    "diff": "diff --git a/boot/image-fit.c b/boot/image-fit.c\nindex 3a6120e9151..c5067b63682 100644\n--- a/boot/image-fit.c\n+++ b/boot/image-fit.c\n@@ -2232,6 +2232,75 @@ static int check_allowed(const void *fit, int noffset,\n \treturn 0;\n }\n \n+/**\n+ * handle_load_op() - Handle the load operation\n+ *\n+ * Process the load_op and figure out where the image should be loaded, now\n+ * that it has been located\n+ *\n+ * @fit: FIT to check\n+ * @noffset: Node offset of the image being loaded\n+ * @prop_name: Property name (in the configuration node) indicating the image\n+ * that was loaded\n+ * @buf: Pointer to image (within the FIT)\n+ * @size: Size of the image in bytes\n+ * @image_type: Type of the image\n+ * @load_op: Load operation to process\n+ * @bootstage_id: ID of starting bootstage to use for progress updates\n+ * @datap: Returns buf\n+ * @loadp: Returns the address to which the data should be loaded\n+ * @load_endp: Returns the end address of the data-loading location\n+ * Return: 0 if OK, -ve on error\n+ */\n+static int handle_load_op(const void *fit, int noffset, const char *prop_name,\n+\t\t\t  void *buf, ulong size,\n+\t\t\t  enum image_type_t image_type,\n+\t\t\t  enum fit_load_op load_op, int bootstage_id,\n+\t\t\t  ulong *datap, ulong *loadp, ulong *load_endp)\n+{\n+\tulong data, load;\n+\n+\tdata = map_to_sysmem(buf);\n+\tload = data;\n+\t*load_endp = 0;\n+\tif (load_op == FIT_LOAD_IGNORED) {\n+\t\tlog_debug(\"load_op: not loading\\n\");\n+\t\t/* Don't load */\n+\t} else if (fit_image_get_load(fit, noffset, &load)) {\n+\t\tif (load_op == FIT_LOAD_REQUIRED) {\n+\t\t\tprintf(\"Can't get %s subimage load address!\\n\",\n+\t\t\t       prop_name);\n+\t\t\tbootstage_error(bootstage_id + BOOTSTAGE_SUB_LOAD);\n+\t\t\treturn -EBADF;\n+\t\t}\n+\t} else if (load_op != FIT_LOAD_OPTIONAL_NON_ZERO || load) {\n+\t\tulong image_start, image_end;\n+\n+\t\t/*\n+\t\t * move image data to the load address,\n+\t\t * make sure we don't overwrite initial image\n+\t\t */\n+\t\timage_start = map_to_sysmem(fit);\n+\t\timage_end = image_start + fit_get_size(fit);\n+\n+\t\t*load_endp = load + size;\n+\t\tif (image_type != IH_TYPE_KERNEL &&\n+\t\t    load < image_end && *load_endp > image_start) {\n+\t\t\tprintf(\"Error: %s overwritten\\n\", prop_name);\n+\t\t\treturn -EXDEV;\n+\t\t}\n+\n+\t\tprintf(\"   Loading %s from 0x%08lx to 0x%08lx\\n\",\n+\t\t       prop_name, data, load);\n+\t} else {\n+\t\tload = data;\t/* No load address specified */\n+\t}\n+\t*datap = data;\n+\t*loadp = load;\n+\n+\treturn 0;\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   enum image_arch_t arch, int ph_type, int bootstage_id,\n@@ -2305,40 +2374,10 @@ int fit_image_load(struct bootm_headers *images, ulong addr,\n \n \tbootstage_mark(bootstage_id + BOOTSTAGE_SUB_GET_DATA_OK);\n \n-\tdata = map_to_sysmem(buf);\n-\tload = data;\n-\tif (load_op == FIT_LOAD_IGNORED) {\n-\t\tlog_debug(\"load_op: not loading\\n\");\n-\t\t/* Don't load */\n-\t} else if (fit_image_get_load(fit, noffset, &load)) {\n-\t\tif (load_op == FIT_LOAD_REQUIRED) {\n-\t\t\tprintf(\"Can't get %s subimage load address!\\n\",\n-\t\t\t       prop_name);\n-\t\t\tbootstage_error(bootstage_id + BOOTSTAGE_SUB_LOAD);\n-\t\t\treturn -EBADF;\n-\t\t}\n-\t} else if (load_op != FIT_LOAD_OPTIONAL_NON_ZERO || load) {\n-\t\tulong image_start, image_end;\n-\n-\t\t/*\n-\t\t * move image data to the load address,\n-\t\t * make sure we don't overwrite initial image\n-\t\t */\n-\t\timage_start = addr;\n-\t\timage_end = addr + fit_get_size(fit);\n-\n-\t\tload_end = load + len;\n-\t\tif (image_type != IH_TYPE_KERNEL &&\n-\t\t    load < image_end && load_end > image_start) {\n-\t\t\tprintf(\"Error: %s overwritten\\n\", prop_name);\n-\t\t\treturn -EXDEV;\n-\t\t}\n-\n-\t\tprintf(\"   Loading %s from 0x%08lx to 0x%08lx\\n\",\n-\t\t       prop_name, data, load);\n-\t} else {\n-\t\tload = data;\t/* No load address specified */\n-\t}\n+\tret = handle_load_op(fit, noffset, prop_name, buf, len, image_type,\n+\t\t\t     load_op, bootstage_id, &data, &load, &load_end);\n+\tif (ret)\n+\t\treturn ret;\n \n \tcomp = IH_COMP_NONE;\n \tloadbuf = buf;\n",
    "prefixes": [
        "05/13"
    ]
}