From: Liam Howlett <liam.howlett@oracle.com>
To: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"kernel-janitors@vger.kernel.org"
<kernel-janitors@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] lib: maple_tree: remove unneeded initialization in mtree_range_walk()
Date: Wed, 26 Oct 2022 14:25:21 +0000 [thread overview]
Message-ID: <20221026142514.ipe6rm6ekyh2rre6@revolver> (raw)
In-Reply-To: <20221026120029.12555-2-lukas.bulwahn@gmail.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
* Lukas Bulwahn <lukas.bulwahn@gmail.com> [221026 08:01]:
> Before the do-while loop in mtree_range_walk(), the variables next, min,
> max need to be initialized. The variables last, prev_min and prev_max are
> set within the loop body before they are eventually used after exiting the
> loop body.
>
> As it is a do-while loop, the loop body is executed at least once, so the
> variables last, prev_min and prev_max do not need to be initialized before
> the loop body.
>
> Remove unneeded initialization of last and prev_min.
>
> The needless initialization was reported by clang-analyzer as Dead Stores.
>
> As the compiler already identifies these assignments as unneeded, it
> optimizes the assignments away. Hence:
>
> No functional change. No change in object code.
>
> Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
> ---
> lib/maple_tree.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index e1743803c851..fbde494444b8 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -2903,8 +2903,8 @@ static inline void *mtree_range_walk(struct ma_state *mas)
> unsigned long max, min;
> unsigned long prev_max, prev_min;
>
> - last = next = mas->node;
> - prev_min = min = mas->min;
> + next = mas->node;
> + min = mas->min;
> max = mas->max;
> do {
> offset = 0;
> --
> 2.17.1
>
next prev parent reply other threads:[~2022-10-26 14:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-26 12:00 [PATCH 0/1] Dead stores in maple-tree Lukas Bulwahn
2022-10-26 12:00 ` [PATCH 1/1] lib: maple_tree: remove unneeded initialization in mtree_range_walk() Lukas Bulwahn
2022-10-26 14:25 ` Liam Howlett [this message]
2022-10-26 14:23 ` [PATCH 0/1] Dead stores in maple-tree Liam Howlett
2022-10-27 7:43 ` Dan Carpenter
2022-10-27 17:16 ` Liam Howlett
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=20221026142514.ipe6rm6ekyh2rre6@revolver \
--to=liam.howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lukas.bulwahn@gmail.com \
--cc=willy@infradead.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