diff options
author | Rasmus Villemoes <linux@rasmusvillemoes.dk> | 2015-09-09 17:42:06 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-09-24 20:30:50 -0400 |
commit | 7236214c88454d96de7633e07a8314644d529f26 (patch) | |
tree | 55a5a0bbafadd1c74793205a717d3c043c815e0c /drivers/base | |
parent | a6f5f0dd4e21191ce35030dd4d6421e1cca10ee4 (diff) |
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 <linux@rasmusvillemoes.dk>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/power/wakeup.c | 4 |
1 files changed, 2 insertions, 2 deletions
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) | |||
94 | if (!ws) | 94 | if (!ws) |
95 | return NULL; | 95 | return NULL; |
96 | 96 | ||
97 | wakeup_source_prepare(ws, name ? kstrdup(name, GFP_KERNEL) : NULL); | 97 | wakeup_source_prepare(ws, name ? kstrdup_const(name, GFP_KERNEL) : NULL); |
98 | return ws; | 98 | return ws; |
99 | } | 99 | } |
100 | EXPORT_SYMBOL_GPL(wakeup_source_create); | 100 | EXPORT_SYMBOL_GPL(wakeup_source_create); |
@@ -157,7 +157,7 @@ void wakeup_source_destroy(struct wakeup_source *ws) | |||
157 | 157 | ||
158 | wakeup_source_drop(ws); | 158 | wakeup_source_drop(ws); |
159 | wakeup_source_record(ws); | 159 | wakeup_source_record(ws); |
160 | kfree(ws->name); | 160 | kfree_const(ws->name); |
161 | kfree(ws); | 161 | kfree(ws); |
162 | } | 162 | } |
163 | EXPORT_SYMBOL_GPL(wakeup_source_destroy); | 163 | EXPORT_SYMBOL_GPL(wakeup_source_destroy); |