[PATCH] ubifs: Remove unreachable code

Kunwu Chan chentao at kylinos.cn
Sat Nov 11 06:33:14 PST 2023


Because there is no break statement in the dead loop above,it is
impossible to execute the 'err=0' statement.Delete the code that
will never execute and initialize 'err' at the start of the function.

Fixes: 6fb324a4b0c3 ("UBIFS: allocate ltab checking buffer on demand")
Signed-off-by: Kunwu Chan <chentao at kylinos.cn>
---
 fs/ubifs/lpt_commit.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c
index c4d079328b92..d4751628fe70 100644
--- a/fs/ubifs/lpt_commit.c
+++ b/fs/ubifs/lpt_commit.c
@@ -1589,8 +1589,8 @@ static int dbg_is_node_dirty(struct ubifs_info *c, int node_type, int lnum,
  */
 static int dbg_check_ltab_lnum(struct ubifs_info *c, int lnum)
 {
-	int err, len = c->leb_size, dirty = 0, node_type, node_num, node_len;
-	int ret;
+	int len = c->leb_size, dirty = 0, node_type, node_num, node_len;
+	int ret, err = 0;
 	void *buf, *p;
 
 	if (!dbg_is_chk_lprops(c))
@@ -1646,7 +1646,6 @@ static int dbg_check_ltab_lnum(struct ubifs_info *c, int lnum)
 		len -= node_len;
 	}
 
-	err = 0;
 out:
 	vfree(buf);
 	return err;
-- 
2.34.1




More information about the linux-mtd mailing list