9
0
Fork 0

bootm: close open files

Signed-off-by: Vicente <vicencb@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Vicente 2012-10-09 00:55:17 +02:00 committed by Sascha Hauer
parent 7764b1faca
commit 8083e2e024
2 changed files with 8 additions and 2 deletions

View File

@ -269,8 +269,9 @@ static int do_bootz_linux(struct image_data *data)
ret = do_bootz_linux_fdt(fd, data);
if (ret && ret != -ENXIO)
return ret;
goto err_out;
close(fd);
return __do_bootm_linux(data, swap);
err_out:
@ -431,6 +432,7 @@ static int do_bootm_aimage(struct image_data *data)
reset_cpu(0);
}
close(fd);
return __do_bootm_linux(data, 0);
err_out:

View File

@ -70,6 +70,7 @@ static int bootm_open_os_uimage(struct image_data *data)
if (ret) {
printf("Checking data crc failed with %s\n",
strerror(-ret));
uimage_close(data->os);
return ret;
}
}
@ -79,6 +80,7 @@ static int bootm_open_os_uimage(struct image_data *data)
if (data->os->header.ih_arch != IH_ARCH) {
printf("Unsupported Architecture 0x%x\n",
data->os->header.ih_arch);
uimage_close(data->os);
return -EINVAL;
}
@ -88,8 +90,10 @@ static int bootm_open_os_uimage(struct image_data *data)
if (data->os_address != UIMAGE_INVALID_ADDRESS) {
data->os_res = uimage_load_to_sdram(data->os, 0,
data->os_address);
if (!data->os_res)
if (!data->os_res) {
uimage_close(data->os);
return -ENOMEM;
}
}
return 0;