Skip to contentSkip to conversation

f2fs: remove redundant assignment to variable err

PATCH Applied Colin Ian King 4 participants 4 messages Mar 19, 2025 – Mar 20, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs: remove redundant assignment to variable err

The variable err is being assigned a value zero and then the following goto page_hit reassigns err a new value. The zero assignment is redundant and can be removed.

---
 fs/f2fs/node.c | 1 -
 1 file changed, 1 deletion(-)
fs/f2fs/node.c +0 -1
index 5f15c224bf78..37c76bb19a8c 100644
@@ -1497,7 +1497,6 @@ static struct folio *__get_node_folio(struct f2fs_sb_info *sbi, pgoff_t nid,
 	if (err < 0) {
 		goto out_put_err;
 	} else if (err == LOCKED_PAGE) {
-		err = 0;
 		goto page_hit;
 	}
 
Signature · 1 line
2.49.0
#2 lore raw
In reply to Colin Ian King
Quoted 14 lines · Colin Ian King

The variable err is being assigned a value zero and then the following goto page_hit reassigns err a new value. The zero assignment is redundant and can be removed.

---
 fs/f2fs/node.c | 1 -
 1 file changed, 1 deletion(-)
fs/f2fs/node.c +0 -0
index 5f15c224bf78..37c76bb19a8c 100644

fs/f2fs/node.c static struct folio *__get_node_folio(struct f2fs_sb_info *sbi, pgoff_t nid, · line 1501

Quoted 6 lines
fs/f2fs/node.c +0 -1
@@ -1497,7 +1497,6 @@ static struct folio *__get_node_folio(struct f2fs_sb_info *sbi, pgoff_t nid,
 	if (err < 0) {
 		goto out_put_err;
 	} else if (err == LOCKED_PAGE) {
-		err = 0;
 		goto page_hit;
 	}

We could remove the curly braces as well.

regards,
dan carpenter

maintainer Applied
#3 lore raw
Quoted 10 lines · Dan Carpenter
Quoted 9 lines · Colin Ian King

The variable err is being assigned a value zero and then the following goto page_hit reassigns err a new value. The zero assignment is redundant and can be removed.

---
 fs/f2fs/node.c | 1 -
 1 file changed, 1 deletion(-)
Quoted 13 lines

fs/f2fs/node.c static struct folio *__get_node_folio(struct f2fs_sb_info *sbi, pgoff_t nid, · line 1501

Quoted 11 lines
fs/f2fs/node.c +0 -1
index 5f15c224bf78..37c76bb19a8c 100644
@@ -1497,7 +1497,6 @@ static struct folio *__get_node_folio(struct f2fs_sb_info *sbi, pgoff_t nid,
 	if (err < 0) {
 		goto out_put_err;
 	} else if (err == LOCKED_PAGE) {
-		err = 0;
 		goto page_hit;
 	}

We could remove the curly braces as well.

Applied as below. Thanks.

@@ -1494,12 +1494,10 @@ static struct folio *__get_node_folio(struct f2fs_sb_info *sbi, pgoff_t nid,

                return folio;

        err = read_node_page(&folio->page, 0);
-       if (err < 0) {
+       if (err < 0)
                goto out_put_err;
-       } else if (err == LOCKED_PAGE) {
-               err = 0;
+       if (err == LOCKED_PAGE)
                goto page_hit;

- }

        if (parent)
                f2fs_ra_node_pages(parent, start + 1, MAX_RA_NODE);
Quoted 3 lines

regards,
dan carpenter