diff options
Diffstat (limited to 'fs/sysfs')
-rw-r--r-- | fs/sysfs/dir.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index b197016bbfbe..f281cc6584b0 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -783,6 +783,7 @@ int sysfs_rename_dir(struct kobject * kobj, const char *new_name) | |||
783 | old_dentry = sysfs_get_dentry(sd); | 783 | old_dentry = sysfs_get_dentry(sd); |
784 | if (IS_ERR(old_dentry)) { | 784 | if (IS_ERR(old_dentry)) { |
785 | error = PTR_ERR(old_dentry); | 785 | error = PTR_ERR(old_dentry); |
786 | old_dentry = NULL; | ||
786 | goto out; | 787 | goto out; |
787 | } | 788 | } |
788 | 789 | ||
@@ -850,6 +851,7 @@ int sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent_kobj) | |||
850 | old_dentry = sysfs_get_dentry(sd); | 851 | old_dentry = sysfs_get_dentry(sd); |
851 | if (IS_ERR(old_dentry)) { | 852 | if (IS_ERR(old_dentry)) { |
852 | error = PTR_ERR(old_dentry); | 853 | error = PTR_ERR(old_dentry); |
854 | old_dentry = NULL; | ||
853 | goto out; | 855 | goto out; |
854 | } | 856 | } |
855 | old_parent = old_dentry->d_parent; | 857 | old_parent = old_dentry->d_parent; |
@@ -857,6 +859,7 @@ int sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent_kobj) | |||
857 | new_parent = sysfs_get_dentry(new_parent_sd); | 859 | new_parent = sysfs_get_dentry(new_parent_sd); |
858 | if (IS_ERR(new_parent)) { | 860 | if (IS_ERR(new_parent)) { |
859 | error = PTR_ERR(new_parent); | 861 | error = PTR_ERR(new_parent); |
862 | new_parent = NULL; | ||
860 | goto out; | 863 | goto out; |
861 | } | 864 | } |
862 | 865 | ||
@@ -880,7 +883,6 @@ again: | |||
880 | error = 0; | 883 | error = 0; |
881 | d_add(new_dentry, NULL); | 884 | d_add(new_dentry, NULL); |
882 | d_move(old_dentry, new_dentry); | 885 | d_move(old_dentry, new_dentry); |
883 | dput(new_dentry); | ||
884 | 886 | ||
885 | /* Remove from old parent's list and insert into new parent's list. */ | 887 | /* Remove from old parent's list and insert into new parent's list. */ |
886 | sysfs_unlink_sibling(sd); | 888 | sysfs_unlink_sibling(sd); |