Commit 3bd3a54a authored by Simon Glass's avatar Simon Glass Committed by Tom Rini

mkimage: Ensure file is closed in fdt_property_file()

The file that is opened is not closed in all cases. Fix it.

Reported-by: Coverity (CID: 138490)
Signed-off-by: default avatarSimon Glass <>
Reviewed-by: default avatarTom Rini <>
parent 7b0bbd88
......@@ -123,13 +123,14 @@ static int fdt_property_file(struct image_tool_params *params,
ret = fdt_property_placeholder(fdt, "data", sbuf.st_size, &ptr);
if (ret)
return ret;
goto err;
ret = read(fd, ptr, sbuf.st_size);
if (ret != sbuf.st_size) {
fprintf(stderr, "%s: Can't read %s: %s\n",
params->cmdname, fname, strerror(errno));
goto err;
return 0;
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