[PATCH 3/5] clocksource: Initialize cs->wd_list

From: Peter Zijlstra
Date: Mon Apr 23 2018 - 12:30:07 EST


In a number of places we rely on list_empty(&cs->wd_list), however we
do not initialize this list_head. Do so upon registration, such that
thereafter we can rely on list_empty() correctly reflecting the list
membership status.

Tested-by: Diego Viola <diego.viola@xxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
---
kernel/time/clocksource.c | 2 ++
1 file changed, 2 insertions(+)

--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -332,6 +332,8 @@ static void clocksource_resume_watchdog(

static void clocksource_enqueue_watchdog(struct clocksource *cs)
{
+ INIT_LIST_HEAD(&cs->wd_list);
+
if (cs->flags & CLOCK_SOURCE_MUST_VERIFY) {
/* cs is a clocksource to be watched. */
list_add(&cs->wd_list, &watchdog_list);