diff options
-rw-r--r-- | arch/x86/kernel/tsc_32.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/x86/kernel/tsc_32.c b/arch/x86/kernel/tsc_32.c index d78444c788a..f04d08a7d02 100644 --- a/arch/x86/kernel/tsc_32.c +++ b/arch/x86/kernel/tsc_32.c @@ -131,7 +131,7 @@ unsigned long native_calculate_cpu_khz(void) { unsigned long long start, end; unsigned long count; - u64 delta64; + u64 delta64 = (u64)ULLONG_MAX; int i; unsigned long flags; @@ -143,6 +143,7 @@ unsigned long native_calculate_cpu_khz(void) rdtscll(start); mach_countup(&count); rdtscll(end); + delta64 = min(delta64, (end - start)); } /* * Error: ECTCNEVERSET @@ -153,8 +154,6 @@ unsigned long native_calculate_cpu_khz(void) if (count <= 1) goto err; - delta64 = end - start; - /* cpu freq too fast: */ if (delta64 > (1ULL<<32)) goto err; |