[PATCH][next] f2fs: remove redundant assignment to variable err

Colin Ian King posted 1 patch 9 months ago
fs/f2fs/node.c | 1 -
1 file changed, 1 deletion(-)
[PATCH][next] f2fs: remove redundant assignment to variable err
Posted by Colin Ian King 9 months ago
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.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 fs/f2fs/node.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 5f15c224bf78..37c76bb19a8c 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -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;
 	}
 
-- 
2.49.0
Re: [PATCH][next] f2fs: remove redundant assignment to variable err
Posted by Dan Carpenter 9 months ago
On Wed, Mar 19, 2025 at 11:30:10AM +0000, Colin Ian King wrote:
> 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.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  fs/f2fs/node.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index 5f15c224bf78..37c76bb19a8c 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -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
Re: [PATCH][next] f2fs: remove redundant assignment to variable err
Posted by Jaegeuk Kim 9 months ago
On 03/19, Dan Carpenter wrote:
> On Wed, Mar 19, 2025 at 11:30:10AM +0000, Colin Ian King wrote:
> > 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.
> > 
> > Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> > ---
> >  fs/f2fs/node.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> > index 5f15c224bf78..37c76bb19a8c 100644
> > --- a/fs/f2fs/node.c
> > +++ b/fs/f2fs/node.c
> > @@ -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);

> 
> regards,
> dan carpenter
Re: [PATCH][next] f2fs: remove redundant assignment to variable err
Posted by Chao Yu 9 months ago
On 3/19/25 19:30, Colin Ian King wrote:
> 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.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,