summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/sysfs.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index f66632fefe0a..c71db7acb89d 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -1362,18 +1362,22 @@ static int btrfs_sysfs_add_fs_devices(struct btrfs_fs_devices *fs_devices)
list_for_each_entry(device, &fs_devices->devices, dev_list) {
ret = btrfs_sysfs_add_device(device);
if (ret)
- return ret;
+ goto fail;
}
list_for_each_entry(seed, &fs_devices->seed_list, seed_list) {
list_for_each_entry(device, &seed->devices, dev_list) {
ret = btrfs_sysfs_add_device(device);
if (ret)
- return ret;
+ goto fail;
}
}
return 0;
+
+fail:
+ btrfs_sysfs_remove_fs_devices(fs_devices);
+ return ret;
}
void btrfs_kobject_uevent(struct block_device *bdev, enum kobject_action action)