2023-07-06 14:30:06

by Wang Ming

[permalink] [raw]
Subject: [PATCH v1] lib:Remove repeated initialization

The original code initializes 'entry'
twice in line 3229 and 3232, which
causes duplicate initialization issue.
To fix this, we remove the initialization
of 'entry' in line 3229.

Signed-off-by: Wang Ming <[email protected]>
---
lib/test_maple_tree.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c
index 9f60e0c4cc8c..2ec14c310dad 100644
--- a/lib/test_maple_tree.c
+++ b/lib/test_maple_tree.c
@@ -3226,7 +3226,6 @@ static noinline void __init check_state_handling(struct maple_tree *mt)

/* next: none -> active, skip value at location */
mas_set(&mas, 0);
- entry = mas_next(&mas, ULONG_MAX);
mas.node = MAS_NONE;
mas.offset = 0;
entry = mas_next(&mas, ULONG_MAX);
--
2.25.1



2023-07-06 15:19:28

by Matthew Wilcox

[permalink] [raw]
Subject: Re: [PATCH v1] lib:Remove repeated initialization

On Thu, Jul 06, 2023 at 10:03:01PM +0800, Wang Ming wrote:
> The original code initializes 'entry'
> twice in line 3229 and 3232, which
> causes duplicate initialization issue.
> To fix this, we remove the initialization
> of 'entry' in line 3229.

mas_next() has a side-effect; it's not a pure initialisation.
Fix your tool.