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>
diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c
index 79388ff..bbd9546 100644
--- a/common/spl/spl_nand.c
+++ b/common/spl/spl_nand.c
@@ -32,7 +32,10 @@
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 @@
/* 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(