diff options
Diffstat (limited to 'lib/kobject.c')
-rw-r--r-- | lib/kobject.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/kobject.c b/lib/kobject.c index aeefa8bc8b1c..e07ee1fcd6f1 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
@@ -47,13 +47,11 @@ static int populate_dir(struct kobject *kobj) | |||
47 | static int create_dir(struct kobject *kobj) | 47 | static int create_dir(struct kobject *kobj) |
48 | { | 48 | { |
49 | int error = 0; | 49 | int error = 0; |
50 | if (kobject_name(kobj)) { | 50 | error = sysfs_create_dir(kobj); |
51 | error = sysfs_create_dir(kobj); | 51 | if (!error) { |
52 | if (!error) { | 52 | error = populate_dir(kobj); |
53 | error = populate_dir(kobj); | 53 | if (error) |
54 | if (error) | 54 | sysfs_remove_dir(kobj); |
55 | sysfs_remove_dir(kobj); | ||
56 | } | ||
57 | } | 55 | } |
58 | return error; | 56 | return error; |
59 | } | 57 | } |
@@ -634,7 +632,7 @@ struct kobject *kobject_create(void) | |||
634 | /** | 632 | /** |
635 | * kobject_create_and_add - create a struct kobject dynamically and register it with sysfs | 633 | * kobject_create_and_add - create a struct kobject dynamically and register it with sysfs |
636 | * | 634 | * |
637 | * @name: the name for the kset | 635 | * @name: the name for the kobject |
638 | * @parent: the parent kobject of this kobject, if any. | 636 | * @parent: the parent kobject of this kobject, if any. |
639 | * | 637 | * |
640 | * This function creates a kobject structure dynamically and registers it | 638 | * This function creates a kobject structure dynamically and registers it |