[PATCH 1/3] mkimage: fit: do not overwrite fdt_setprop return value
Quentin Schulz
foss+uboot at 0leil.net
Tue Sep 23 12:27:20 CEST 2025
From: Quentin Schulz <quentin.schulz at cherry.de>
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 at cherry.de>
---
tools/fit_image.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tools/fit_image.c b/tools/fit_image.c
index 331be5ae71d94691c7f6aa77547746409cfc074e..88a9060256a1acc0f33c084fb6fad241d160b0fa 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -745,14 +745,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);
--
2.51.0
More information about the U-Boot
mailing list