From 77ab1514607b7b379d6538729b5df04369f006c3 Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Thu, 22 Aug 2024 23:59:45 +0200 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/84040 Reviewed-by: Nico Huber Tested-by: build bot (Jenkins) --- src/cpu/x86/smm/tseg_region.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/cpu/x86') diff --git a/src/cpu/x86/smm/tseg_region.c b/src/cpu/x86/smm/tseg_region.c index 413d5fcb8b..90e61dc426 100644 --- a/src/cpu/x86/smm/tseg_region.c +++ b/src/cpu/x86/smm/tseg_region.c @@ -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) -- cgit v1.2.3