tools: mkimage: propagate error codes from fit_handle_file()
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>
diff --git a/tools/fit_image.c b/tools/fit_image.c
index caed8d5..3d2fbad 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -750,7 +750,7 @@
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 @@
err_system:
unlink(tmpfile);
unlink(bakfile);
- return -1;
+ return ret;
}
/**