public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] jbd2: remove redundant assignement to variable err
@ 2024-04-10 11:28 Colin Ian King
  2024-04-10 12:05 ` Jan Kara
  2024-05-07 23:03 ` Theodore Ts'o
  0 siblings, 2 replies; 3+ messages in thread
From: Colin Ian King @ 2024-04-10 11:28 UTC (permalink / raw)
  To: Theodore Ts'o, Jan Kara, linux-ext4; +Cc: kernel-janitors, linux-kernel

The variable err is being assigned a value that is never read, it
is being re-assigned inside the following while loop and also
after the while loop. The assignment is redundant and can be
removed.

Cleans up clang scan build warning:
fs/jbd2/commit.c:574:2: warning: Value stored to 'err' is never
read [deadcode.DeadStores]

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

diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index 5e122586e06e..78a9d08ae9f8 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -571,7 +571,6 @@ void jbd2_journal_commit_transaction(journal_t *journal)
 	J_ASSERT(commit_transaction->t_nr_buffers <=
 		 atomic_read(&commit_transaction->t_outstanding_credits));
 
-	err = 0;
 	bufs = 0;
 	descriptor = NULL;
 	while (commit_transaction->t_buffers) {
-- 
2.39.2


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

* Re: [PATCH][next] jbd2: remove redundant assignement to variable err
  2024-04-10 11:28 [PATCH][next] jbd2: remove redundant assignement to variable err Colin Ian King
@ 2024-04-10 12:05 ` Jan Kara
  2024-05-07 23:03 ` Theodore Ts'o
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Kara @ 2024-04-10 12:05 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Theodore Ts'o, Jan Kara, linux-ext4, kernel-janitors,
	linux-kernel

On Wed 10-04-24 12:28:03, Colin Ian King wrote:
> The variable err is being assigned a value that is never read, it
> is being re-assigned inside the following while loop and also
> after the while loop. The assignment is redundant and can be
> removed.
> 
> Cleans up clang scan build warning:
> fs/jbd2/commit.c:574:2: warning: Value stored to 'err' is never
> read [deadcode.DeadStores]
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

OK, this assignment indeed looks redundant and is not even making code
easier to reason about. So feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/jbd2/commit.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
> index 5e122586e06e..78a9d08ae9f8 100644
> --- a/fs/jbd2/commit.c
> +++ b/fs/jbd2/commit.c
> @@ -571,7 +571,6 @@ void jbd2_journal_commit_transaction(journal_t *journal)
>  	J_ASSERT(commit_transaction->t_nr_buffers <=
>  		 atomic_read(&commit_transaction->t_outstanding_credits));
>  
> -	err = 0;
>  	bufs = 0;
>  	descriptor = NULL;
>  	while (commit_transaction->t_buffers) {
> -- 
> 2.39.2
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

* Re: [PATCH][next] jbd2: remove redundant assignement to variable err
  2024-04-10 11:28 [PATCH][next] jbd2: remove redundant assignement to variable err Colin Ian King
  2024-04-10 12:05 ` Jan Kara
@ 2024-05-07 23:03 ` Theodore Ts'o
  1 sibling, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2024-05-07 23:03 UTC (permalink / raw)
  To: Jan Kara, linux-ext4, Colin Ian King
  Cc: Theodore Ts'o, kernel-janitors, linux-kernel


On Wed, 10 Apr 2024 12:28:03 +0100, Colin Ian King wrote:
> The variable err is being assigned a value that is never read, it
> is being re-assigned inside the following while loop and also
> after the while loop. The assignment is redundant and can be
> removed.
> 
> Cleans up clang scan build warning:
> fs/jbd2/commit.c:574:2: warning: Value stored to 'err' is never
> read [deadcode.DeadStores]
> 
> [...]

Applied, thanks!

[1/1] jbd2: remove redundant assignement to variable err
      commit: 8b57de1c5edde3faf8a4f6a440b7ec16bb3c81d4

Best regards,
-- 
Theodore Ts'o <tytso@mit.edu>

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

end of thread, other threads:[~2024-05-07 23:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-10 11:28 [PATCH][next] jbd2: remove redundant assignement to variable err Colin Ian King
2024-04-10 12:05 ` Jan Kara
2024-05-07 23:03 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox