diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-08-14 06:19:59 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-08-14 06:19:59 -0400 |
commit | 8d7ccaa545490cdffdfaff0842436a8dd85cf47b (patch) | |
tree | 8129b5907161bc6ae26deb3645ce1e280c5e1f51 /lib/kobject.c | |
parent | b2139aa0eec330c711c5a279db361e5ef1178e78 (diff) | |
parent | 30a2f3c60a84092c8084dfe788b710f8d0768cd4 (diff) |
Merge commit 'v2.6.27-rc3' into x86/prototypes
Conflicts:
include/asm-x86/dma-mapping.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 | } |