Skip to content

Commit

Permalink
PM / Sleep: Initialize wakeup source locks in wakeup_source_add()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Rafael J. Wysocki committed Feb 13, 2012
1 parent a556d5b commit 7c95149
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/base/power/wakeup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 7c95149

Please sign in to comment.