summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/volumes.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index c7a08fe26672..8bfc41f1b3b6 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1115,6 +1115,7 @@ static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig)
1115 struct btrfs_fs_devices *fs_devices; 1115 struct btrfs_fs_devices *fs_devices;
1116 struct btrfs_device *device; 1116 struct btrfs_device *device;
1117 struct btrfs_device *orig_dev; 1117 struct btrfs_device *orig_dev;
1118 int ret = 0;
1118 1119
1119 fs_devices = alloc_fs_devices(orig->fsid, NULL); 1120 fs_devices = alloc_fs_devices(orig->fsid, NULL);
1120 if (IS_ERR(fs_devices)) 1121 if (IS_ERR(fs_devices))
@@ -1128,8 +1129,10 @@ static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig)
1128 1129
1129 device = btrfs_alloc_device(NULL, &orig_dev->devid, 1130 device = btrfs_alloc_device(NULL, &orig_dev->devid,
1130 orig_dev->uuid); 1131 orig_dev->uuid);
1131 if (IS_ERR(device)) 1132 if (IS_ERR(device)) {
1133 ret = PTR_ERR(device);
1132 goto error; 1134 goto error;
1135 }
1133 1136
1134 /* 1137 /*
1135 * This is ok to do without rcu read locked because we hold the 1138 * This is ok to do without rcu read locked because we hold the
@@ -1140,6 +1143,7 @@ static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig)
1140 GFP_KERNEL); 1143 GFP_KERNEL);
1141 if (!name) { 1144 if (!name) {
1142 btrfs_free_device(device); 1145 btrfs_free_device(device);
1146 ret = -ENOMEM;
1143 goto error; 1147 goto error;
1144 } 1148 }
1145 rcu_assign_pointer(device->name, name); 1149 rcu_assign_pointer(device->name, name);
@@ -1154,7 +1158,7 @@ static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig)
1154error: 1158error:
1155 mutex_unlock(&orig->device_list_mutex); 1159 mutex_unlock(&orig->device_list_mutex);
1156 free_fs_devices(fs_devices); 1160 free_fs_devices(fs_devices);
1157 return ERR_PTR(-ENOMEM); 1161 return ERR_PTR(ret);
1158} 1162}
1159 1163
1160/* 1164/*