]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
tools: mkimage: propagate error codes from fit_handle_file()
authorAristo Chen <jj251510319013@gmail.com>
Tue, 10 Jun 2025 07:41:17 +0000 (07:41 +0000)
committerTom Rini <trini@konsulko.com>
Thu, 26 Jun 2025 14:12:54 +0000 (08:12 -0600)
The fit_handle_file() function previously returned a hardcoded -1 on
error. This change updates the logic to return the actual error code
stored in `ret`, allowing for error propagation.

This improves debuggability and enables downstream callers to
distinguish different failure causes, such as FDT_ERR_NOTFOUND or
other errors.

Signed-off-by: Aristo Chen <aristo.chen@canonical.com>
tools/fit_image.c

index caed8d5f9019e5cd78e9239d085f68f91d0e16e5..3d2fbad3853bfa6c17a1b8d9f041e26bdc39fa3a 100644 (file)
@@ -750,7 +750,7 @@ static int fit_handle_file(struct image_tool_params *params)
        char bakfile[MKIMAGE_MAX_TMPFILE_LEN + 4] = {0};
        char cmd[MKIMAGE_MAX_DTC_CMDLINE_LEN];
        size_t size_inc;
-       int ret;
+       int ret = EXIT_FAILURE;
 
        /* Flattened Image Tree (FIT) format  handling */
        debug ("FIT format handling\n");
@@ -854,7 +854,7 @@ static int fit_handle_file(struct image_tool_params *params)
 err_system:
        unlink(tmpfile);
        unlink(bakfile);
-       return -1;
+       return ret;
 }
 
 /**