mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Kent Overstreet' <kent.overstreet@linux.dev>,
	Colin Ian King <colin.i.king@gmail.com>
Cc: Brian Foster <bfoster@redhat.com>,
	"linux-bcachefs@vger.kernel.org" <linux-bcachefs@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH][next] bcachefs: remove redundant initialization of variable level
Date: Sat, 11 Nov 2023 21:19:40 +0000	[thread overview]
Message-ID: <184af6778ab64b3eb6a4a6071974d5e8@AcuMS.aculab.com> (raw)
In-Reply-To: <20231111210208.qra7xhf2nd4pqvst@moria.home.lan>

From: Kent Overstreet <kent.overstreet@linux.dev>
> Sent: 11 November 2023 21:02
> > Variable level is being initialized a value that is never read, the
> > variable is being re-assigned another value several statements later
> > on. The initialization is redundant and can be removed. Cleans up
> > clang scan build warning:
> >
> > fs/bcachefs/btree_iter.c:1217:11: warning: Value stored to 'level'
> > during its initialization is never read [deadcode.DeadStores]
> >
> > Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> 
> since we're no longer gnu89, we can simply declare the variable when
> it's first used, like so:

ugg... I think that is still frowned upon.
It makes it very difficult for the average human to find
the variable declaration.

	David

> 
> diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
> index 96bdf0c6051c..104172f6822b 100644
> --- a/fs/bcachefs/btree_iter.c
> +++ b/fs/bcachefs/btree_iter.c
> @@ -1214,8 +1214,6 @@ __bch2_btree_path_set_pos(struct btree_trans *trans,
>  		   struct btree_path *path, struct bpos new_pos,
>  		   bool intent, unsigned long ip, int cmp)
>  {
> -	unsigned level = path->level;
> -
>  	bch2_trans_verify_not_in_restart(trans);
>  	EBUG_ON(!path->ref);
> 
> @@ -1231,7 +1229,7 @@ __bch2_btree_path_set_pos(struct btree_trans *trans,
>  		goto out;
>  	}
> 
> -	level = btree_path_up_until_good_node(trans, path, cmp);
> +	unsigned level = btree_path_up_until_good_node(trans, path, cmp);
> 
>  	if (btree_path_node(path, level)) {
>  		struct btree_path_level *l = &path->l[level];

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


  reply	other threads:[~2023-11-11 21:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-11 20:45 Colin Ian King
2023-11-11 21:02 ` Kent Overstreet
2023-11-11 21:19   ` David Laight [this message]
2023-11-11 23:39     ` Kent Overstreet
2023-11-12 18:34       ` David Laight
2023-11-12 19:12         ` Kent Overstreet
2023-11-20 12:00           ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=184af6778ab64b3eb6a4a6071974d5e8@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=bfoster@redhat.com \
    --cc=colin.i.king@gmail.com \
    --cc=kent.overstreet@linux.dev \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-bcachefs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®