All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] f2fs: remove redundant assignment to variable err
@ 2023-06-16 14:20 Colin Ian King
  0 siblings, 0 replies; 6+ messages in thread
From: Colin Ian King @ 2023-06-16 14:20 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu, linux-f2fs-devel; +Cc: kernel-janitors, linux-kernel

The assignment to variable err is redundant since the code jumps to
label next and err is then re-assigned a new value on the call to
sanity_check_node_chain. Remove the assignment.

Cleans up clang scan build warning:
fs/f2fs/recovery.c:464:6: warning: Value stored to 'err' is never read [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 fs/f2fs/recovery.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c
index f0cf1538389c..4e7d4ceeb084 100644
--- a/fs/f2fs/recovery.c
+++ b/fs/f2fs/recovery.c
@@ -460,10 +460,8 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head,
 								quota_inode);
 			if (IS_ERR(entry)) {
 				err = PTR_ERR(entry);
-				if (err == -ENOENT) {
-					err = 0;
+				if (err == -ENOENT)
 					goto next;
-				}
 				f2fs_put_page(page, 1);
 				break;
 			}
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH][next] f2fs: remove redundant assignment to variable err
@ 2025-03-19 11:30 Colin Ian King
  2025-03-19 12:09 ` Chao Yu
  2025-03-19 12:31 ` Dan Carpenter
  0 siblings, 2 replies; 6+ messages in thread
From: Colin Ian King @ 2025-03-19 11:30 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu, linux-f2fs-devel; +Cc: kernel-janitors, linux-kernel

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH][next] f2fs: remove redundant assignment to variable err
  2025-03-19 11:30 [PATCH][next] f2fs: remove redundant assignment to variable err Colin Ian King
@ 2025-03-19 12:09 ` Chao Yu
  2025-03-19 12:31 ` Dan Carpenter
  1 sibling, 0 replies; 6+ messages in thread
From: Chao Yu @ 2025-03-19 12:09 UTC (permalink / raw)
  To: Colin Ian King, Jaegeuk Kim, linux-f2fs-devel
  Cc: chao, kernel-janitors, linux-kernel

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,

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][next] f2fs: remove redundant assignment to variable err
  2025-03-19 11:30 [PATCH][next] f2fs: remove redundant assignment to variable err Colin Ian King
  2025-03-19 12:09 ` Chao Yu
@ 2025-03-19 12:31 ` Dan Carpenter
  2025-03-20  2:26     ` [f2fs-dev] " Jaegeuk Kim via Linux-f2fs-devel
  1 sibling, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2025-03-19 12:31 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Jaegeuk Kim, Chao Yu, linux-f2fs-devel, kernel-janitors,
	linux-kernel

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][next] f2fs: remove redundant assignment to variable err
  2025-03-19 12:31 ` Dan Carpenter
@ 2025-03-20  2:26     ` Jaegeuk Kim via Linux-f2fs-devel
  0 siblings, 0 replies; 6+ messages in thread
From: Jaegeuk Kim @ 2025-03-20  2:26 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Colin Ian King, Chao Yu, linux-f2fs-devel, kernel-janitors,
	linux-kernel

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [f2fs-dev] [PATCH][next] f2fs: remove redundant assignment to variable err
@ 2025-03-20  2:26     ` Jaegeuk Kim via Linux-f2fs-devel
  0 siblings, 0 replies; 6+ messages in thread
From: Jaegeuk Kim via Linux-f2fs-devel @ 2025-03-20  2:26 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: kernel-janitors, linux-kernel, Colin Ian King, linux-f2fs-devel

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


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-03-20  2:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-19 11:30 [PATCH][next] f2fs: remove redundant assignment to variable err Colin Ian King
2025-03-19 12:09 ` Chao Yu
2025-03-19 12:31 ` Dan Carpenter
2025-03-20  2:26   ` Jaegeuk Kim
2025-03-20  2:26     ` [f2fs-dev] " Jaegeuk Kim via Linux-f2fs-devel
  -- strict thread matches above, loose matches on Subject: below --
2023-06-16 14:20 Colin Ian King

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.