From b70ec4a569221942babb2462345941514d624c22 Mon Sep 17 00:00:00 2001 From: Kent McLeod Date: Fri, 16 Feb 2024 07:45:44 +1100 Subject: [PATCH] elfloader: Check return code of device init Device initialization returns early if an error is encountered. Handle this error by printing an Error message and aborting the booting process. Signed-off-by: Kent McLeod --- elfloader-tool/src/arch-arm/smp_boot.c | 5 ++++- elfloader-tool/src/arch-arm/sys_boot.c | 11 +++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/elfloader-tool/src/arch-arm/smp_boot.c b/elfloader-tool/src/arch-arm/smp_boot.c index 2745211c..d429d113 100644 --- a/elfloader-tool/src/arch-arm/smp_boot.c +++ b/elfloader-tool/src/arch-arm/smp_boot.c @@ -40,7 +40,10 @@ void non_boot_main(void) } /* Do any driver specific non_boot core init */ - initialise_devices_non_boot(); + if (initialise_devices_non_boot()) { + printf("ERROR: Did not successfully return from initialise_devices_non_boot()\n"); + abort(); + } #ifndef CONFIG_ARM_HYPERVISOR_SUPPORT if (is_hyp_mode()) { diff --git a/elfloader-tool/src/arch-arm/sys_boot.c b/elfloader-tool/src/arch-arm/sys_boot.c index 9f6b17a0..bf98aaf2 100644 --- a/elfloader-tool/src/arch-arm/sys_boot.c +++ b/elfloader-tool/src/arch-arm/sys_boot.c @@ -104,7 +104,11 @@ void main(UNUSED void *arg) void *bootloader_dtb = NULL; /* initialize platform to a state where we can print to a UART */ - initialise_devices(); + if (initialise_devices()) { + printf("ERROR: Did not successfully return from initialise_devices()\n"); + abort(); + } + platform_init(); /* Print welcome message. */ @@ -175,7 +179,10 @@ void continue_boot(int was_relocated) * driver model so all its pointers are set up properly. */ if (was_relocated) { - initialise_devices(); + if (initialise_devices()) { + printf("ERROR: Did not successfully return from initialise_devices()\n"); + abort(); + } } #if (defined(CONFIG_ARCH_ARM_V7A) || defined(CONFIG_ARCH_ARM_V8A)) && !defined(CONFIG_ARM_HYPERVISOR_SUPPORT)