lkml.org 
[lkml]   [2019]   [Mar]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] PM / wakeup: Clear timer.function in wakeup_source_remove()
Date
wakeup_source_activate() performs a check to see if the wakeup source is
registered or not. It works fine for a newly added wakeup source which
may not have been registered but fails to catch the case where a wakeup
source is unregistered as the timer.function is still valid.

Fix it by setting the timer.function to NULL from
wakeup_source_remove().

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/base/power/wakeup.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
index 18333962e3da..3699faca24af 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -206,6 +206,13 @@ void wakeup_source_remove(struct wakeup_source *ws)
synchronize_srcu(&wakeup_srcu);

del_timer_sync(&ws->timer);
+
+ /*
+ * Clear timer.function so that wakeup_source_not_registered() can
+ * detect an unregistered wakeup source.
+ */
+ ws->timer.function = NULL;
+
}
EXPORT_SYMBOL_GPL(wakeup_source_remove);

--
2.21.0.rc0.269.g1a574e7a288b
\
 
 \ /
  Last update: 2019-03-08 10:53    [W:0.073 / U:0.360 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site