diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-07-26 09:30:40 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-26 09:30:40 -0400 |
commit | 1503af661947b7a4a09355cc2ae6aa0d43f16776 (patch) | |
tree | 5bfcfadf2dd2d98c2ad251c96d7ee43a6903819a /lib/kobject.c | |
parent | a31863168660c6b6f6c7ffe05bb6a38e97803326 (diff) | |
parent | 024e8ac04453b3525448c31ef39848cf675ba6db (diff) |
Merge branch 'linus' into x86/header-guards
Conflicts:
include/asm-x86/gpio.h
include/asm-x86/ide.h
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'lib/kobject.c')
-rw-r--r-- | lib/kobject.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/kobject.c b/lib/kobject.c index dcade0543bd2..bd732ffebc85 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
@@ -164,9 +164,8 @@ static int kobject_add_internal(struct kobject *kobj) | |||
164 | return -ENOENT; | 164 | return -ENOENT; |
165 | 165 | ||
166 | if (!kobj->name || !kobj->name[0]) { | 166 | if (!kobj->name || !kobj->name[0]) { |
167 | pr_debug("kobject: (%p): attempted to be registered with empty " | 167 | WARN(1, "kobject: (%p): attempted to be registered with empty " |
168 | "name!\n", kobj); | 168 | "name!\n", kobj); |
169 | WARN_ON(1); | ||
170 | return -EINVAL; | 169 | return -EINVAL; |
171 | } | 170 | } |
172 | 171 | ||
@@ -216,13 +215,19 @@ static int kobject_add_internal(struct kobject *kobj) | |||
216 | static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, | 215 | static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, |
217 | va_list vargs) | 216 | va_list vargs) |
218 | { | 217 | { |
219 | /* Free the old name, if necessary. */ | 218 | const char *old_name = kobj->name; |
220 | kfree(kobj->name); | 219 | char *s; |
221 | 220 | ||
222 | kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs); | 221 | kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs); |
223 | if (!kobj->name) | 222 | if (!kobj->name) |
224 | return -ENOMEM; | 223 | return -ENOMEM; |
225 | 224 | ||
225 | /* ewww... some of these buggers have '/' in the name ... */ | ||
226 | s = strchr(kobj->name, '/'); | ||
227 | if (s) | ||
228 | s[0] = '!'; | ||
229 | |||
230 | kfree(old_name); | ||
226 | return 0; | 231 | return 0; |
227 | } | 232 | } |
228 | 233 | ||
@@ -577,12 +582,10 @@ static void kobject_release(struct kref *kref) | |||
577 | void kobject_put(struct kobject *kobj) | 582 | void kobject_put(struct kobject *kobj) |
578 | { | 583 | { |
579 | if (kobj) { | 584 | if (kobj) { |
580 | if (!kobj->state_initialized) { | 585 | if (!kobj->state_initialized) |
581 | printk(KERN_WARNING "kobject: '%s' (%p): is not " | 586 | WARN(1, KERN_WARNING "kobject: '%s' (%p): is not " |
582 | "initialized, yet kobject_put() is being " | 587 | "initialized, yet kobject_put() is being " |
583 | "called.\n", kobject_name(kobj), kobj); | 588 | "called.\n", kobject_name(kobj), kobj); |
584 | WARN_ON(1); | ||
585 | } | ||
586 | kref_put(&kobj->kref, kobject_release); | 589 | kref_put(&kobj->kref, kobject_release); |
587 | } | 590 | } |
588 | } | 591 | } |