9
0
Fork 0

efi: clocksoure: make sure the meassured frequency is valid

Some EFI implementations have a even slower tick rate and the meassured
frequency may be zero.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Michael Olbrich 2017-03-14 10:37:29 +01:00 committed by Sascha Hauer
parent 2846e53d2d
commit 249b40be7e
1 changed files with 4 additions and 0 deletions

View File

@ -71,6 +71,10 @@ static int efi_cs_init(struct clocksource *cs)
uint64_t nb_100ns;
freq = ticks_freq_x86();
if (freq == 0) {
BS->close_event(efi_cs_evt);
return -ENODEV;
}
nb_100ns = 10 * 1000 * 1000 / freq;
pr_warn("EFI Event timer too slow freq = %llu Hz\n", freq);
efiret = BS->set_timer(efi_cs_evt, EFI_TIMER_PERIODIC, nb_100ns);