summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2024-08-22 23:59:45 +0200
committerArthur Heymans <arthur@aheymans.xyz>2024-08-30 07:35:10 +0000
commit77ab1514607b7b379d6538729b5df04369f006c3 (patch)
treef090b9c97223d4cb92cf3e5c76266b4d12bb62ee /src/lib
parente5742fbd97dedfd787e43333001fa72fb99f50c9 (diff)
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>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ext_stage_cache.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/ext_stage_cache.c b/src/lib/ext_stage_cache.c
index 462a635dc8..427c9c30bb 100644
--- a/src/lib/ext_stage_cache.c
+++ b/src/lib/ext_stage_cache.c
@@ -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");