]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
mkimage: fit: do not overwrite fdt_setprop return value
authorQuentin Schulz <quentin.schulz@cherry.de>
Tue, 23 Sep 2025 10:27:20 +0000 (12:27 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 10 Oct 2025 19:28:36 +0000 (13:28 -0600)
The return code of fdt_setprop is overwritten by the one from
fdt_delprop meaning we could very well have an issue when setting the
property that would be ignored if the deletion of the property that
comes right after passes.

Let's add a separate check for each.

Fixes: 4860ee9b09e0 ("mkimage: allow internalization of data-position")
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
tools/fit_image.c

index 108497338162589739b4345be1c5c79a078d8397..7e2a12aa7d0f128fa9b0287a3d29b2fcd3cf4c27 100644 (file)
@@ -793,14 +793,20 @@ static int fit_import_data(struct image_tool_params *params, const char *fname)
                debug("Importing data size %x\n", len);
 
                ret = fdt_setprop(fdt, node, FIT_DATA_PROP, data, len);
-               ret = fdt_delprop(fdt, node, ext_data_prop);
-
                if (ret) {
                        debug("%s: Failed to write property: %s\n", __func__,
                              fdt_strerror(ret));
                        ret = -EINVAL;
                        goto err_munmap;
                }
+
+               ret = fdt_delprop(fdt, node, ext_data_prop);
+               if (ret) {
+                       debug("%s: Failed to erase property: %s\n", __func__,
+                             fdt_strerror(ret));
+                       ret = -EINVAL;
+                       goto err_munmap;
+               }
        }
 
        confs = fdt_path_offset(fdt, FIT_CONFS_PATH);