cbmem.h: Change return type of cbmem_get_region

The underlying IMD function already returns an integer which indicates
success or failure.

This removes the need to have initialized variables that need to be
checked for NULL later. In some cases this actually adds the appropriate
check for returned values.

Dying is appropriate if cbmem is not found as it is essential to the
bootflow.

Change-Id: Ib3e09a75380faf9f533601368993261f042422ef
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84039
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Arthur Heymans 2024-08-22 23:16:57 +02:00 committed by Felix Held
commit aa75ee1a71
7 changed files with 23 additions and 15 deletions

View file

@ -74,12 +74,13 @@ static void clear_memory(void *unused)
BM_MEM_RAM);
/* Add reserved entries */
void *baseptr = NULL;
size_t size = 0;
void *baseptr;
size_t size;
/* Only skip CBMEM, stage program, stack and heap are included there. */
cbmem_get_region(&baseptr, &size);
if (cbmem_get_region(&baseptr, &size))
die("Could not find cbmem region");
memranges_insert(&mem, (uintptr_t)baseptr, size, BM_MEM_TABLE);
if (ENV_X86) {