Skip to content

Commit

Permalink
elfloader: Check return code of device init
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
kent-mcleod committed Feb 15, 2024
1 parent d23fc87 commit e3d0927
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 4 additions & 1 deletion elfloader-tool/src/arch-arm/smp_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
11 changes: 9 additions & 2 deletions elfloader-tool/src/arch-arm/sys_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e3d0927

Please sign in to comment.