Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 68e18891 authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds
Browse files

[PATCH] x86_64: Make sure hpet_address is 0 when any part of HPET initialization fails



Otherwise TSC->HPET fallback could see incorrect state and crash later.

Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7cd082f0
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -59,7 +59,7 @@ static int notsc __initdata = 0;
unsigned int cpu_khz;					/* TSC clocks / usec, not used here */
unsigned int cpu_khz;					/* TSC clocks / usec, not used here */
static unsigned long hpet_period;			/* fsecs / HPET clock */
static unsigned long hpet_period;			/* fsecs / HPET clock */
unsigned long hpet_tick;				/* HPET clocks / interrupt */
unsigned long hpet_tick;				/* HPET clocks / interrupt */
static int hpet_use_timer;
static int hpet_use_timer;				/* Use counter of hpet for time keeping, otherwise PIT */
unsigned long vxtime_hz = PIT_TICK_RATE;
unsigned long vxtime_hz = PIT_TICK_RATE;
int report_lost_ticks;				/* command line option */
int report_lost_ticks;				/* command line option */
unsigned long long monotonic_base;
unsigned long long monotonic_base;
@@ -908,6 +908,8 @@ void __init time_init(void)
	if (!hpet_init())
	if (!hpet_init())
                vxtime_hz = (1000000000000000L + hpet_period / 2) /
                vxtime_hz = (1000000000000000L + hpet_period / 2) /
			hpet_period;
			hpet_period;
	else
		vxtime.hpet_address = 0;


	if (hpet_use_timer) {
	if (hpet_use_timer) {
		cpu_khz = hpet_calibrate_tsc();
		cpu_khz = hpet_calibrate_tsc();