aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kobject.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-06-26 12:52:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-06-26 12:52:05 -0400
commit47a469421d792dcb91a1e73319d26134241953d2 (patch)
tree6a388381a434ebe87fed2fbb10a53ced7a7ce8b5 /lib/kobject.c
parentc13c81006314ad76c2b31824960a900385601b8b (diff)
parent51229b495340bd7a02ce3622d1966829b67054ea (diff)
Merge branch 'akpm' (patches from Andrew)
Merge second patchbomb from Andrew Morton: - most of the rest of MM - lots of misc things - procfs updates - printk feature work - updates to get_maintainer, MAINTAINERS, checkpatch - lib/ updates * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (96 commits) exit,stats: /* obey this comment */ coredump: add __printf attribute to cn_*printf functions coredump: use from_kuid/kgid when formatting corename fs/reiserfs: remove unneeded cast NILFS2: support NFSv2 export fs/befs/btree.c: remove unneeded initializations fs/minix: remove unneeded cast init/do_mounts.c: add create_dev() failure log kasan: remove duplicate definition of the macro KASAN_FREE_PAGE fs/efs: femove unneeded cast checkpatch: emit "NOTE: <types>" message only once after multiple files checkpatch: emit an error when there's a diff in a changelog checkpatch: validate MODULE_LICENSE content checkpatch: add multi-line handling for PREFER_ETHER_ADDR_COPY checkpatch: suggest using eth_zero_addr() and eth_broadcast_addr() checkpatch: fix processing of MEMSET issues checkpatch: suggest using ether_addr_equal*() checkpatch: avoid NOT_UNIFIED_DIFF errors on cover-letter.patch files checkpatch: remove local from codespell path checkpatch: add --showfile to allow input via pipe to show filenames ...
Diffstat (limited to 'lib/kobject.c')
-rw-r--r--lib/kobject.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/kobject.c b/lib/kobject.c
index 3b841b97fccd..75ee63834fd1 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -257,23 +257,20 @@ static int kobject_add_internal(struct kobject *kobj)
257int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, 257int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
258 va_list vargs) 258 va_list vargs)
259{ 259{
260 const char *old_name = kobj->name;
261 char *s; 260 char *s;
262 261
263 if (kobj->name && !fmt) 262 if (kobj->name && !fmt)
264 return 0; 263 return 0;
265 264
266 kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs); 265 s = kvasprintf(GFP_KERNEL, fmt, vargs);
267 if (!kobj->name) { 266 if (!s)
268 kobj->name = old_name;
269 return -ENOMEM; 267 return -ENOMEM;
270 }
271 268
272 /* ewww... some of these buggers have '/' in the name ... */ 269 /* ewww... some of these buggers have '/' in the name ... */
273 while ((s = strchr(kobj->name, '/'))) 270 strreplace(s, '/', '!');
274 s[0] = '!'; 271 kfree(kobj->name);
272 kobj->name = s;
275 273
276 kfree(old_name);
277 return 0; 274 return 0;
278} 275}
279 276