diff mbox series

spl: spl-nor: return error if no valid image was loaded

Message ID 20230130092143.192282-1-dev@kicherer.org
State Accepted
Commit 1aeedef93744da76fd1e6f5c3b139409fff57dc5
Delegated to: Tom Rini
Headers show
Series spl: spl-nor: return error if no valid image was loaded | expand

Commit Message

Mario Kicherer Jan. 30, 2023, 9:21 a.m. UTC
If only FIT images are enabled and loading the FIT image fails,
spl_nor_load_image() should return an error instead of zero.

Without this patch:

>>SPL: board_init_r()
spl_init
Trying to boot from NOR
Unsupported OS image.. Jumping nevertheless..
image entry point: 0x0

With patch:

>>SPL: board_init_r()
spl_init
Trying to boot from NOR
SPL: failed to boot from all boot devices (err=-6)
.### ERROR ### Please RESET the board ###

Signed-off-by: Mario Kicherer <dev@kicherer.org>
---
 common/spl/spl_nor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tom Rini June 20, 2023, 6:15 p.m. UTC | #1
On Mon, 30 Jan 2023 10:21:43 +0100, Mario Kicherer wrote:

> If only FIT images are enabled and loading the FIT image fails,
> spl_nor_load_image() should return an error instead of zero.
> 
> Without this patch:
> 
> >>SPL: board_init_r()
> spl_init
> Trying to boot from NOR
> Unsupported OS image.. Jumping nevertheless..
> image entry point: 0x0
> 
> [...]

Applied to u-boot/next, thanks!
diff mbox series

Patch

diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c
index ffb3566d89..e75127b275 100644
--- a/common/spl/spl_nor.c
+++ b/common/spl/spl_nor.c
@@ -120,6 +120,6 @@  static int spl_nor_load_image(struct spl_image_info *spl_image,
 					   &hdr);
 	}
 
-	return 0;
+	return -EINVAL;
 }
 SPL_LOAD_IMAGE_METHOD("NOR", 0, BOOT_DEVICE_NOR, spl_nor_load_image);