Commit 5b15a259 authored by Simon Glass's avatar Simon Glass Committed by Tom Rini

mkimage: Don't close the file if it wasn't opened

The error path for fit_import_data() is incorrect if the second open() call

Reported-by: Coverity (CID: 138489)
Signed-off-by: default avatarSimon Glass <>
Reviewed-by: default avatarTom Rini <>
parent 3bd3a54a
......@@ -537,8 +537,8 @@ static int fit_import_data(struct image_tool_params *params, const char *fname)
if (fd < 0) {
fprintf(stderr, "%s: Can't open %s: %s\n",
params->cmdname, fname, strerror(errno));
ret = -EIO;
goto err;
return -EIO;
if (write(fd, fdt, new_size) != new_size) {
debug("%s: Failed to write external data to file %s\n",
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment