diff options
Diffstat (limited to 'fs/sysfs/dir.c')
-rw-r--r-- | fs/sysfs/dir.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 2e6775a836f2..048e6054c2fd 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -699,17 +699,19 @@ static int create_dir(struct kobject *kobj, struct sysfs_dirent *parent_sd, | |||
699 | 699 | ||
700 | /* link in */ | 700 | /* link in */ |
701 | sysfs_addrm_start(&acxt, parent_sd); | 701 | sysfs_addrm_start(&acxt, parent_sd); |
702 | |||
702 | if (!sysfs_find_dirent(parent_sd, name)) { | 703 | if (!sysfs_find_dirent(parent_sd, name)) { |
703 | sysfs_add_one(&acxt, sd); | 704 | sysfs_add_one(&acxt, sd); |
704 | sysfs_link_sibling(sd); | 705 | sysfs_link_sibling(sd); |
705 | } | 706 | } |
706 | if (sysfs_addrm_finish(&acxt)) { | 707 | |
707 | *p_sd = sd; | 708 | if (!sysfs_addrm_finish(&acxt)) { |
708 | return 0; | 709 | sysfs_put(sd); |
710 | return -EEXIST; | ||
709 | } | 711 | } |
710 | 712 | ||
711 | sysfs_put(sd); | 713 | *p_sd = sd; |
712 | return -EEXIST; | 714 | return 0; |
713 | } | 715 | } |
714 | 716 | ||
715 | int sysfs_create_subdir(struct kobject *kobj, const char *name, | 717 | int sysfs_create_subdir(struct kobject *kobj, const char *name, |