diff options
Diffstat (limited to 'fs/sysfs/dir.c')
-rw-r--r-- | fs/sysfs/dir.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 337162935d21..f281cc6584b0 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -678,8 +678,10 @@ static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry, | |||
678 | sd = sysfs_find_dirent(parent_sd, dentry->d_name.name); | 678 | sd = sysfs_find_dirent(parent_sd, dentry->d_name.name); |
679 | 679 | ||
680 | /* no such entry */ | 680 | /* no such entry */ |
681 | if (!sd) | 681 | if (!sd) { |
682 | ret = ERR_PTR(-ENOENT); | ||
682 | goto out_unlock; | 683 | goto out_unlock; |
684 | } | ||
683 | 685 | ||
684 | /* attach dentry and inode */ | 686 | /* attach dentry and inode */ |
685 | inode = sysfs_get_inode(sd); | 687 | inode = sysfs_get_inode(sd); |
@@ -781,6 +783,7 @@ int sysfs_rename_dir(struct kobject * kobj, const char *new_name) | |||
781 | old_dentry = sysfs_get_dentry(sd); | 783 | old_dentry = sysfs_get_dentry(sd); |
782 | if (IS_ERR(old_dentry)) { | 784 | if (IS_ERR(old_dentry)) { |
783 | error = PTR_ERR(old_dentry); | 785 | error = PTR_ERR(old_dentry); |
786 | old_dentry = NULL; | ||
784 | goto out; | 787 | goto out; |
785 | } | 788 | } |
786 | 789 | ||
@@ -848,6 +851,7 @@ int sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent_kobj) | |||
848 | old_dentry = sysfs_get_dentry(sd); | 851 | old_dentry = sysfs_get_dentry(sd); |
849 | if (IS_ERR(old_dentry)) { | 852 | if (IS_ERR(old_dentry)) { |
850 | error = PTR_ERR(old_dentry); | 853 | error = PTR_ERR(old_dentry); |
854 | old_dentry = NULL; | ||
851 | goto out; | 855 | goto out; |
852 | } | 856 | } |
853 | old_parent = old_dentry->d_parent; | 857 | old_parent = old_dentry->d_parent; |
@@ -855,6 +859,7 @@ int sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent_kobj) | |||
855 | new_parent = sysfs_get_dentry(new_parent_sd); | 859 | new_parent = sysfs_get_dentry(new_parent_sd); |
856 | if (IS_ERR(new_parent)) { | 860 | if (IS_ERR(new_parent)) { |
857 | error = PTR_ERR(new_parent); | 861 | error = PTR_ERR(new_parent); |
862 | new_parent = NULL; | ||
858 | goto out; | 863 | goto out; |
859 | } | 864 | } |
860 | 865 | ||
@@ -878,7 +883,6 @@ again: | |||
878 | error = 0; | 883 | error = 0; |
879 | d_add(new_dentry, NULL); | 884 | d_add(new_dentry, NULL); |
880 | d_move(old_dentry, new_dentry); | 885 | d_move(old_dentry, new_dentry); |
881 | dput(new_dentry); | ||
882 | 886 | ||
883 | /* 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. */ |
884 | sysfs_unlink_sibling(sd); | 888 | sysfs_unlink_sibling(sd); |