From 731c90b71380850c0079eaf2762537b82c385f39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Date: Wed, 4 May 2016 13:48:59 +0000 Subject: [PATCH] rtc: fix inverted resolution check The current code in clock_register checks if the newly added clock has a resolution value higher than the current one in order to make it the default, which is wrong. Clocks with a lower resolution value should be better than ones with a higher resolution value, in fact with the current code FreeBSD is always selecting the worse clock. Reviewed by: kib jhb jkim Sponsored by: Citrix Systems R&D MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D6185 --- sys/kern/subr_rtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/subr_rtc.c b/sys/kern/subr_rtc.c index ed2befccacae..5d4167d7ec69 100644 --- a/sys/kern/subr_rtc.c +++ b/sys/kern/subr_rtc.c @@ -84,7 +84,7 @@ clock_register(device_t dev, long res) /* res has units of microseconds */ { if (clock_dev != NULL) { - if (clock_res > res) { + if (clock_res <= res) { if (bootverbose) device_printf(dev, "not installed as " "time-of-day clock: clock %s has higher "