Skip to content

Commit f2655ac

Browse files
paulmckrcuKAGA-KOKO
authored andcommitted
clocksource: Fix brown-bag boolean thinko in cs_watchdog_read()
The current "nretries > 1 || nretries >= max_retries" check in cs_watchdog_read() will always evaluate to true, and thus pr_warn(), if nretries is greater than 1. The intent is instead to never warn on the first try, but otherwise warn if the successful retry was the last retry. Therefore, change that "||" to "&&". Fixes: db3a34e ("clocksource: Retry clock read if long delays detected") Reported-by: Borislav Petkov <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/all/[email protected]
1 parent 6881e75 commit f2655ac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/time/clocksource.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ static enum wd_read_status cs_watchdog_read(struct clocksource *cs, u64 *csnow,
246246

247247
wd_delay = cycles_to_nsec_safe(watchdog, *wdnow, wd_end);
248248
if (wd_delay <= WATCHDOG_MAX_SKEW) {
249-
if (nretries > 1 || nretries >= max_retries) {
249+
if (nretries > 1 && nretries >= max_retries) {
250250
pr_warn("timekeeping watchdog on CPU%d: %s retried %d times before success\n",
251251
smp_processor_id(), watchdog->name, nretries);
252252
}

0 commit comments

Comments
 (0)