ext_stage_cache: Make sure variables are initialized
GCC LTO incorrectly warns about this it seems. This also exits gracefully from stage-cache code if no smm region is found. Change-Id: Ib1851295646258e97c489dc7402b9df3fcf092c1 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/84040 Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
e5742fbd97
commit
77ab151460
2 changed files with 7 additions and 6 deletions
|
|
@ -53,8 +53,6 @@ int smm_subregion(int sub, uintptr_t *start, size_t *size)
|
|||
sub_size = ied_size;
|
||||
break;
|
||||
default:
|
||||
*start = 0;
|
||||
*size = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -65,11 +63,10 @@ int smm_subregion(int sub, uintptr_t *start, size_t *size)
|
|||
|
||||
void stage_cache_external_region(void **base, size_t *size)
|
||||
{
|
||||
if (smm_subregion(SMM_SUBREGION_CACHE, (uintptr_t *)base, size)) {
|
||||
*base = NULL;
|
||||
*size = 0;
|
||||
if (smm_subregion(SMM_SUBREGION_CACHE, (uintptr_t *)base, size))
|
||||
printk(BIOS_ERR, "No cache SMM subregion.\n");
|
||||
*base = NULL;
|
||||
*size = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void smm_list_regions(void)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ static void stage_cache_create_empty(void)
|
|||
|
||||
imd = &imd_stage_cache;
|
||||
stage_cache_external_region(&base, &size);
|
||||
if (base == NULL || size == 0)
|
||||
return;
|
||||
imd_handle_init(imd, (void *)(size + (uintptr_t)base));
|
||||
|
||||
printk(BIOS_DEBUG, "External stage cache:\n");
|
||||
|
|
@ -32,6 +34,8 @@ static void stage_cache_recover(void)
|
|||
|
||||
imd = &imd_stage_cache;
|
||||
stage_cache_external_region(&base, &size);
|
||||
if (base == NULL || size == 0)
|
||||
return;
|
||||
imd_handle_init(imd, (void *)(size + (uintptr_t)base));
|
||||
if (imd_recover(imd))
|
||||
printk(BIOS_DEBUG, "Unable to recover external stage cache.\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue