aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorYouling Tang <tangyouling@kylinos.cn>2024-10-16 09:49:11 +0800
committerKent Overstreet <kent.overstreet@linux.dev>2024-12-21 01:36:17 -0500
commit385d1a3c81fee16202b1c5a980653807a8c8dc95 (patch)
treed9e149c75f6807a6aa7c2116db1b4abe79121ead
parentbcachefs: Remove redundant initialization in bch2_vfs_inode_init() (diff)
downloadwireguard-linux-385d1a3c81fee16202b1c5a980653807a8c8dc95.tar.xz
wireguard-linux-385d1a3c81fee16202b1c5a980653807a8c8dc95.zip
bcachefs: Simplify code in bch2_dev_alloc()
- Remove unnecessary variable 'ret'. - Remove unnecessary bch2_dev_free() operations. Signed-off-by: Youling Tang <tangyouling@kylinos.cn> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/super.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index 7e0ff17a6dbb..ab678231afd4 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -1369,7 +1369,6 @@ static int bch2_dev_alloc(struct bch_fs *c, unsigned dev_idx)
{
struct bch_member member = bch2_sb_member_get(c->disk_sb.sb, dev_idx);
struct bch_dev *ca = NULL;
- int ret = 0;
if (bch2_fs_init_fault("dev_alloc"))
goto err;
@@ -1381,10 +1380,8 @@ static int bch2_dev_alloc(struct bch_fs *c, unsigned dev_idx)
ca->fs = c;
bch2_dev_attach(c, ca, dev_idx);
- return ret;
+ return 0;
err:
- if (ca)
- bch2_dev_free(ca);
return -BCH_ERR_ENOMEM_dev_alloc;
}