diff options
author | David Sterba <dsterba@suse.com> | 2017-10-30 19:29:46 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-01-22 16:08:12 +0100 |
commit | 5c4cf6c91d717b76008b0c8fef7b2947b5da2a4f (patch) | |
tree | 732f779a892ef0d365a7a99a58a9712f304f1687 /fs/btrfs/volumes.c | |
parent | btrfs: use free_device where opencoded (diff) | |
download | linux-5c4cf6c91d717b76008b0c8fef7b2947b5da2a4f.tar.xz linux-5c4cf6c91d717b76008b0c8fef7b2947b5da2a4f.zip |
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>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index f93994a49321..3fa83ff9b30f 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -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); if (!name) { - free_device(device); ret = -ENOMEM; - goto error; + goto error_free_device; } rcu_assign_pointer(device->name, name); trans = btrfs_start_transaction(root, 0); if (IS_ERR(trans)) { - free_device(device); ret = PTR_ERR(trans); - goto error; + goto error_free_device; } q = bdev_get_queue(bdev); @@ -2495,6 +2493,7 @@ error_trans: sb->s_flags |= SB_RDONLY; if (trans) btrfs_end_transaction(trans); +error_free_device: free_device(device); error: blkdev_put(bdev, FMODE_EXCL); |