]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
PM / Sleep: Initialize wakeup source locks in wakeup_source_add()
authorRafael J. Wysocki <rjw@sisk.pl>
Fri, 10 Feb 2012 23:00:11 +0000 (00:00 +0100)
committerRafael J. Wysocki <rjw@sisk.pl>
Mon, 13 Feb 2012 15:25:51 +0000 (16:25 +0100)
Initialize wakeup source locks in wakeup_source_add() instead of
wakeup_source_create(), because otherwise the locks of the wakeup
sources that haven't been allocated with wakeup_source_create()
aren't initialized and handled properly.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
drivers/base/power/wakeup.c

index caf995fb774b4ceef6ad03809ac7a2f1b5a5e9e5..6e591a8a49da1aa873e1ae61197abde0008c9575 100644 (file)
@@ -64,7 +64,6 @@ struct wakeup_source *wakeup_source_create(const char *name)
        if (!ws)
                return NULL;
 
-       spin_lock_init(&ws->lock);
        if (name)
                ws->name = kstrdup(name, GFP_KERNEL);
 
@@ -105,6 +104,7 @@ void wakeup_source_add(struct wakeup_source *ws)
        if (WARN_ON(!ws))
                return;
 
+       spin_lock_init(&ws->lock);
        setup_timer(&ws->timer, pm_wakeup_timer_fn, (unsigned long)ws);
        ws->active = false;