diff options
Diffstat (limited to 'lib/kobject.c')
-rw-r--r-- | lib/kobject.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/kobject.c b/lib/kobject.c index 7a0e6809490d..fe4ae36ce960 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
@@ -162,6 +162,11 @@ int kobject_add(struct kobject * kobj) | |||
162 | return -ENOENT; | 162 | return -ENOENT; |
163 | if (!kobj->k_name) | 163 | if (!kobj->k_name) |
164 | kobj->k_name = kobj->name; | 164 | kobj->k_name = kobj->name; |
165 | if (!kobj->k_name) { | ||
166 | pr_debug("kobject attempted to be registered with no name!\n"); | ||
167 | WARN_ON(1); | ||
168 | return -EINVAL; | ||
169 | } | ||
165 | parent = kobject_get(kobj->parent); | 170 | parent = kobject_get(kobj->parent); |
166 | 171 | ||
167 | pr_debug("kobject %s: registering. parent: %s, set: %s\n", | 172 | pr_debug("kobject %s: registering. parent: %s, set: %s\n", |