summaryrefslogtreecommitdiff
path: root/common/spl/spl_nand.c
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2016-04-29 00:44:54 +0200
committerStefano Babic <sbabic@denx.de>2016-05-17 17:52:20 +0200
commit7e0f22674ae871460706f9cc8653487bb51e0804 (patch)
tree604b55f32c78eee29614bfd6a99d7525f168384d /common/spl/spl_nand.c
parent249092fa81f3dd3fee94fd05973833e30405f3c4 (diff)
SPL: Let spl_parse_image_header() return value
Allow the spl_parse_image_header() to return value. This is convenient for controlling the SPL boot flow if the loaded image is corrupted. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Fabio Estevam <fabio.estevam@nxp.com> Cc: Peng Fan <van.freenix@gmail.com> Cc: Stefano Babic <sbabic@denx.de> Cc: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'common/spl/spl_nand.c')
-rw-r--r--common/spl/spl_nand.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c
index 79388ff326a..bbd95469870 100644
--- a/common/spl/spl_nand.c
+++ b/common/spl/spl_nand.c
@@ -32,7 +32,10 @@ static int spl_nand_load_element(int offset, struct image_header *header)
if (err)
return err;
- spl_parse_image_header(header);
+ err = spl_parse_image_header(header);
+ if (err)
+ return err;
+
return nand_spl_load_image(offset, spl_image.size,
(void *)(unsigned long)spl_image.load_addr);
}
@@ -77,7 +80,9 @@ int spl_nand_load_image(void)
/* load linux */
nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS,
sizeof(*header), (void *)header);
- spl_parse_image_header(header);
+ err = spl_parse_image_header(header);
+ if (err)
+ return err;
if (header->ih_os == IH_OS_LINUX) {
/* happy - was a linux */
err = nand_spl_load_image(