From: Rasmus Villemoes Date: Wed, 9 Sep 2015 21:42:06 +0000 (+0200) Subject: PM / wakeup: wakeup_source_create: use kstrdup_const X-Git-Tag: v4.4-rc1~135^2~4^2~5^2 X-Git-Url: http://git.cascardo.eti.br/?a=commitdiff_plain;h=7236214c88454d96de7633e07a8314644d529f26;p=cascardo%2Flinux.git 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: Rasmus Villemoes Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c index 3b361ecfaffc..a1e0b9ab847a 100644 --- a/drivers/base/power/wakeup.c +++ b/drivers/base/power/wakeup.c @@ -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);