mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] efi: clocksoure: make sure the meassured frequency is valid
@ 2017-03-14  9:37 Michael Olbrich
  2017-03-15  7:27 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Olbrich @ 2017-03-14  9:37 UTC (permalink / raw)
  To: barebox; +Cc: Michael Olbrich

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>
---
 drivers/clocksource/efi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/clocksource/efi.c b/drivers/clocksource/efi.c
index 89906c452eb7..fb5b7ca63de9 100644
--- a/drivers/clocksource/efi.c
+++ b/drivers/clocksource/efi.c
@@ -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);
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-15  7:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-14  9:37 [PATCH] efi: clocksoure: make sure the meassured frequency is valid Michael Olbrich
2017-03-15  7:27 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox