From c03828056d84e06f5687d296a2808b3ee5e4dfce Mon Sep 17 00:00:00 2001 From: Youling Tang Date: Wed, 16 Oct 2024 09:49:11 +0800 Subject: [PATCH 073/233] bcachefs: Simplify code in bch2_dev_alloc() Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit - Remove unnecessary variable 'ret'. - Remove unnecessary bch2_dev_free() operations. Signed-off-by: Youling Tang Signed-off-by: Kent Overstreet Signed-off-by: Alexander Miroshnichenko --- fs/bcachefs/super.c | 5 +---- 1 file changed, 1 insertion(+), 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; } -- 2.45.2