aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCornelia Huck <cornelia.huck@de.ibm.com>2009-10-06 09:33:35 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-10-14 18:16:25 -0400
commita6a8357788d6a37f8ad0f7eb46b0a386b613abb9 (patch)
treeb8505a5394bc7f825753e0451f421b8333388e37
parent80f506918fdaaca6b574ba931536a58ce015c7be (diff)
sysfs: Allow sysfs_move_dir(..., NULL) again.
As device_move() and kobject_move() both handle a NULL destination, sysfs_move_dir() should do this as well (again) and fall back to sysfs_root in that case. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Cc: Phil Carmody <ext-phil.2.carmody@nokia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--fs/sysfs/dir.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 0050fc40e8c9..5fad489ce5bc 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -894,7 +894,8 @@ int sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent_kobj)
894 894
895 mutex_lock(&sysfs_rename_mutex); 895 mutex_lock(&sysfs_rename_mutex);
896 BUG_ON(!sd->s_parent); 896 BUG_ON(!sd->s_parent);
897 new_parent_sd = new_parent_kobj->sd ? new_parent_kobj->sd : &sysfs_root; 897 new_parent_sd = (new_parent_kobj && new_parent_kobj->sd) ?
898 new_parent_kobj->sd : &sysfs_root;
898 899
899 error = 0; 900 error = 0;
900 if (sd->s_parent == new_parent_sd) 901 if (sd->s_parent == new_parent_sd)