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

Commit 7236214c authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Rafael J. Wysocki
Browse files

PM / wakeup: wakeup_source_create: use kstrdup_const



Using kstrdup_const allows us to save a little runtime memory (and a
string copy) in the common case where name is a string literal.

Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent a6f5f0dd
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ struct wakeup_source *wakeup_source_create(const char *name)
	if (!ws)
		return NULL;

	wakeup_source_prepare(ws, name ? kstrdup(name, GFP_KERNEL) : NULL);
	wakeup_source_prepare(ws, name ? kstrdup_const(name, GFP_KERNEL) : NULL);
	return ws;
}
EXPORT_SYMBOL_GPL(wakeup_source_create);
@@ -157,7 +157,7 @@ void wakeup_source_destroy(struct wakeup_source *ws)

	wakeup_source_drop(ws);
	wakeup_source_record(ws);
	kfree(ws->name);
	kfree_const(ws->name);
	kfree(ws);
}
EXPORT_SYMBOL_GPL(wakeup_source_destroy);