wakeup: fix endless loop in wakeup source show [1/1]
authorJianxin Pan <jianxin.pan@amlogic.com>
Fri, 28 Jun 2019 05:23:55 +0000 (01:23 -0400)
committerJianxin Pan <jianxin.pan@amlogic.com>
Mon, 1 Jul 2019 02:59:20 +0000 (19:59 -0700)
PD#SWPL-10134

Problem:
endless loop in wakeup source show

Solution:
fix endless loop in wakeup source show

Verify:
TL1

Change-Id: If2318e31388b4a656cf8d99058f8aeaf76ff97a0
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
drivers/base/power/wakeup.c

index fd1b5c819af8f0ddee0e96900e9f3abbf152c709..03eb3eb798ca44dd412752139568fa05e2491d16 100644 (file)
@@ -1075,8 +1075,16 @@ static int wakeup_sources_stats_show(struct seq_file *m, void *unused)
                "last_change\tprevent_suspend_time\n");
 
        srcuidx = srcu_read_lock(&wakeup_srcu);
-       list_for_each_entry_rcu(ws, &wakeup_sources, entry)
+       list_for_each_entry_rcu(ws, &wakeup_sources, entry) {
                print_wakeup_source_stats(m, ws);
+#ifdef CONFIG_AMLOGIC_MODIFY
+               if (ws->entry.next == ws->entry.prev) {
+                       pr_err(" <%s> name:%s <%p, %p>\n", __func__,
+                               ws->name,  ws->entry.next, ws->entry.prev);
+                       break;
+               }
+#endif
+       }
        srcu_read_unlock(&wakeup_srcu, srcuidx);
 
        print_wakeup_source_stats(m, &deleted_ws);