Skip to contentSkip to conversation

lib:Remove repeated initialization

PATCH In review Wang Ming 3 participants 3 messages Jul 6, 2023

Subsystems (3)
lore
Share & tools
lore

Wang Ming

author
#0 lore raw

PATCH 1/1 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.

---
 lib/test_maple_tree.c | 1 -
 1 file changed, 1 deletion(-)
lib/test_maple_tree.c +0 -1
index 9f60e0c4cc8c..2ec14c310dad 100644
@@ -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);
Signature · 1 line
2.25.1
#1 lore raw
Quoted 5 lines · Wang Ming

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.

#2 lore raw

Re: [PATCH] lib: Remove repeated “initialization” in check_state_handling()

In reply to Wang Ming

Would the information “test_maple_tree: …” be more appropriate for the subsystem specification in the patch subject?

Quoted 5 lines

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