aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/kobject.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/kobject.c b/lib/kobject.c
index 8e7c71993487..1699eb9161f3 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -407,6 +407,7 @@ static struct kobj_type dir_ktype = {
407struct kobject *kobject_add_dir(struct kobject *parent, const char *name) 407struct kobject *kobject_add_dir(struct kobject *parent, const char *name)
408{ 408{
409 struct kobject *k; 409 struct kobject *k;
410 int ret;
410 411
411 if (!parent) 412 if (!parent)
412 return NULL; 413 return NULL;
@@ -418,7 +419,13 @@ struct kobject *kobject_add_dir(struct kobject *parent, const char *name)
418 k->parent = parent; 419 k->parent = parent;
419 k->ktype = &dir_ktype; 420 k->ktype = &dir_ktype;
420 kobject_set_name(k, name); 421 kobject_set_name(k, name);
421 kobject_register(k); 422 ret = kobject_register(k);
423 if (ret < 0) {
424 printk(KERN_WARNING "kobject_add_dir: "
425 "kobject_register error: %d\n", ret);
426 kobject_del(k);
427 return NULL;
428 }
422 429
423 return k; 430 return k;
424} 431}