btrfs: simplify exit paths in btrfs_init_new_device
Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
55de480346
commit
5c4cf6c91d
|
@ -2345,17 +2345,15 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
|
||||||
|
|
||||||
name = rcu_string_strdup(device_path, GFP_KERNEL);
|
name = rcu_string_strdup(device_path, GFP_KERNEL);
|
||||||
if (!name) {
|
if (!name) {
|
||||||
free_device(device);
|
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto error;
|
goto error_free_device;
|
||||||
}
|
}
|
||||||
rcu_assign_pointer(device->name, name);
|
rcu_assign_pointer(device->name, name);
|
||||||
|
|
||||||
trans = btrfs_start_transaction(root, 0);
|
trans = btrfs_start_transaction(root, 0);
|
||||||
if (IS_ERR(trans)) {
|
if (IS_ERR(trans)) {
|
||||||
free_device(device);
|
|
||||||
ret = PTR_ERR(trans);
|
ret = PTR_ERR(trans);
|
||||||
goto error;
|
goto error_free_device;
|
||||||
}
|
}
|
||||||
|
|
||||||
q = bdev_get_queue(bdev);
|
q = bdev_get_queue(bdev);
|
||||||
|
@ -2495,6 +2493,7 @@ error_trans:
|
||||||
sb->s_flags |= SB_RDONLY;
|
sb->s_flags |= SB_RDONLY;
|
||||||
if (trans)
|
if (trans)
|
||||||
btrfs_end_transaction(trans);
|
btrfs_end_transaction(trans);
|
||||||
|
error_free_device:
|
||||||
free_device(device);
|
free_device(device);
|
||||||
error:
|
error:
|
||||||
blkdev_put(bdev, FMODE_EXCL);
|
blkdev_put(bdev, FMODE_EXCL);
|
||||||
|
|
Loading…
Reference in New Issue