From 56f1221f2fd00d27fedb6de9f8501127e66f5878 Mon Sep 17 00:00:00 2001 From: Felix Held Date: Fri, 24 Mar 2023 19:30:43 +0100 Subject: [PATCH] soc/amd/common/block/cpu/tsc_freq: move static variable inside function Move the static mhz variable inside the only function that is accessing it. Signed-off-by: Felix Held Change-Id: Ief98c0a1c35fe1bbc4ff38dd175f12e0b3ddc515 Reviewed-on: https://review.coreboot.org/c/coreboot/+/74014 Tested-by: build bot (Jenkins) Reviewed-by: Eric Lai Reviewed-by: Martin Roth --- src/soc/amd/common/block/cpu/tsc/tsc_freq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/soc/amd/common/block/cpu/tsc/tsc_freq.c b/src/soc/amd/common/block/cpu/tsc/tsc_freq.c index f177b77673..40bac9df3a 100644 --- a/src/soc/amd/common/block/cpu/tsc/tsc_freq.c +++ b/src/soc/amd/common/block/cpu/tsc/tsc_freq.c @@ -7,8 +7,6 @@ #include #include -static unsigned long mhz; - /* Use this default TSC frequency when it can not be correctly calculated. Higher numbers are safer as it will result in longer delays using TSC */ #define TSC_DEFAULT_FREQ_MHZ 4000 @@ -17,6 +15,7 @@ unsigned long tsc_freq_mhz(void) { union pstate_msr pstate_reg; uint8_t high_state; + static unsigned long mhz; if (mhz) return mhz;