[PATCH 3.16 250/366] clocksource: Initialize cs->wd_list

From: Ben Hutchings
Date: Sun Oct 14 2018 - 11:34:07 EST


3.16.60-rc1 review patch. If anyone has any objections, please let me know.

------------------

From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>

commit 5b9e886a4af97574ca3ce1147f35545da0e7afc7 upstream.

A number of places relies on list_empty(&cs->wd_list), however the
list_head does not get initialized. Do so upon registration, such that
thereafter it is possible to rely on list_empty() correctly reflecting
the list membership status.

Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Tested-by: Diego Viola <diego.viola@xxxxxxxxx>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Cc: len.brown@xxxxxxxxx
Cc: rjw@xxxxxxxxxxxxx
Cc: rui.zhang@xxxxxxxxx
Link: https://lkml.kernel.org/r/20180430100344.472662715@xxxxxxxxxxxxx
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
kernel/time/clocksource.c | 2 ++
1 file changed, 2 insertions(+)

--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -385,6 +385,8 @@ static void clocksource_enqueue_watchdog
{
unsigned long flags;

+ INIT_LIST_HEAD(&cs->wd_list);
+
spin_lock_irqsave(&watchdog_lock, flags);
if (cs->flags & CLOCK_SOURCE_MUST_VERIFY) {
/* cs is a clocksource to be watched. */