Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7c95149b authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

PM / Sleep: Initialize wakeup source locks in wakeup_source_add()



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: default avatarRafael J. Wysocki <rjw@sisk.pl>
parent a556d5b5
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -64,7 +64,6 @@ struct wakeup_source *wakeup_source_create(const char *name)
	if (!ws)
	if (!ws)
		return NULL;
		return NULL;


	spin_lock_init(&ws->lock);
	if (name)
	if (name)
		ws->name = kstrdup(name, GFP_KERNEL);
		ws->name = kstrdup(name, GFP_KERNEL);


@@ -105,6 +104,7 @@ void wakeup_source_add(struct wakeup_source *ws)
	if (WARN_ON(!ws))
	if (WARN_ON(!ws))
		return;
		return;


	spin_lock_init(&ws->lock);
	setup_timer(&ws->timer, pm_wakeup_timer_fn, (unsigned long)ws);
	setup_timer(&ws->timer, pm_wakeup_timer_fn, (unsigned long)ws);
	ws->active = false;
	ws->active = false;