aboutsummaryrefslogtreecommitdiffstats
path: root/fs/sysfs/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/sysfs/dir.c')
-rw-r--r--fs/sysfs/dir.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 511edef8b321..2bab1b4ddf5a 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -378,12 +378,10 @@ int sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent)
378 struct sysfs_dirent *new_parent_sd, *sd; 378 struct sysfs_dirent *new_parent_sd, *sd;
379 int error; 379 int error;
380 380
381 if (!new_parent)
382 return -EINVAL;
383
384 old_parent_dentry = kobj->parent ? 381 old_parent_dentry = kobj->parent ?
385 kobj->parent->dentry : sysfs_mount->mnt_sb->s_root; 382 kobj->parent->dentry : sysfs_mount->mnt_sb->s_root;
386 new_parent_dentry = new_parent->dentry; 383 new_parent_dentry = new_parent ?
384 new_parent->dentry : sysfs_mount->mnt_sb->s_root;
387 385
388again: 386again:
389 mutex_lock(&old_parent_dentry->d_inode->i_mutex); 387 mutex_lock(&old_parent_dentry->d_inode->i_mutex);