projects
/
cascardo
/
linux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[cascardo/linux.git]
/
lib
/
kobject.c
diff --git
a/lib/kobject.c
b/lib/kobject.c
index
718e510
..
bd732ff
100644
(file)
--- a/
lib/kobject.c
+++ b/
lib/kobject.c
@@
-164,9
+164,8
@@
static int kobject_add_internal(struct kobject *kobj)
return -ENOENT;
if (!kobj->name || !kobj->name[0]) {
return -ENOENT;
if (!kobj->name || !kobj->name[0]) {
-
pr_debug(
"kobject: (%p): attempted to be registered with empty "
+
WARN(1,
"kobject: (%p): attempted to be registered with empty "
"name!\n", kobj);
"name!\n", kobj);
- WARN_ON(1);
return -EINVAL;
}
return -EINVAL;
}
@@
-216,13
+215,19
@@
static int kobject_add_internal(struct kobject *kobj)
static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
va_list vargs)
{
static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
va_list vargs)
{
- /* Free the old name, if necessary. */
-
kfree(kobj->name)
;
+ const char *old_name = kobj->name;
+
char *s
;
kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs);
if (!kobj->name)
return -ENOMEM;
kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs);
if (!kobj->name)
return -ENOMEM;
+ /* ewww... some of these buggers have '/' in the name ... */
+ s = strchr(kobj->name, '/');
+ if (s)
+ s[0] = '!';
+
+ kfree(old_name);
return 0;
}
return 0;
}
@@
-439,6
+444,7
@@
out:
return error;
}
return error;
}
+EXPORT_SYMBOL_GPL(kobject_rename);
/**
* kobject_move - move object to another parent
/**
* kobject_move - move object to another parent
@@
-576,12
+582,10
@@
static void kobject_release(struct kref *kref)
void kobject_put(struct kobject *kobj)
{
if (kobj) {
void kobject_put(struct kobject *kobj)
{
if (kobj) {
- if (!kobj->state_initialized)
{
-
printk(
KERN_WARNING "kobject: '%s' (%p): is not "
+ if (!kobj->state_initialized)
+
WARN(1,
KERN_WARNING "kobject: '%s' (%p): is not "
"initialized, yet kobject_put() is being "
"called.\n", kobject_name(kobj), kobj);
"initialized, yet kobject_put() is being "
"called.\n", kobject_name(kobj), kobj);
- WARN_ON(1);
- }
kref_put(&kobj->kref, kobject_release);
}
}
kref_put(&kobj->kref, kobject_release);
}
}