diff mbox series

[v1] lib:Remove repeated initialization

Message ID 20230706140314.9999-1-machel@vivo.com (mailing list archive)
State New
Headers show
Series [v1] lib:Remove repeated initialization | expand

Commit Message

Wang Ming July 6, 2023, 2:03 p.m. UTC
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 <machel@vivo.com>
---
 lib/test_maple_tree.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Matthew Wilcox July 6, 2023, 2:45 p.m. UTC | #1
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.
Markus Elfring July 6, 2023, 7:42 p.m. UTC | #2
Would the information “test_maple_tree: …” be more appropriate
for the subsystem specification in the patch subject?


> 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.

* Why did you choose 41 characters as a line length maximum
  for your change description?

* Would you like to achieve reconsiderations of implementation details
  by other means than patches?

* How do you think about to clarify the usage of affected variable
  assignments better?

* What does hinder you to take any requirements from the Linux development
  documentation better into account?

See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.4

Regards,
Markus
diff mbox series

Patch

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);