linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] lib:Remove repeated initialization
@ 2023-07-06 14:03 Wang Ming
  2023-07-06 14:45 ` Matthew Wilcox
  2023-07-06 19:42 ` [PATCH] lib: Remove repeated “initialization” in check_state_handling() Markus Elfring
  0 siblings, 2 replies; 3+ messages in thread
From: Wang Ming @ 2023-07-06 14:03 UTC (permalink / raw)
  To: Liam R. Howlett, linux-mm, linux-kernel; +Cc: opensource.kernel, 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.

Signed-off-by: Wang Ming <machel@vivo.com>
---
 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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] lib:Remove repeated initialization
  2023-07-06 14:03 [PATCH v1] lib:Remove repeated initialization Wang Ming
@ 2023-07-06 14:45 ` Matthew Wilcox
  2023-07-06 19:42 ` [PATCH] lib: Remove repeated “initialization” in check_state_handling() Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: Matthew Wilcox @ 2023-07-06 14:45 UTC (permalink / raw)
  To: Wang Ming; +Cc: Liam R. Howlett, linux-mm, linux-kernel, opensource.kernel

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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] lib: Remove repeated “initialization” in check_state_handling()
  2023-07-06 14:03 [PATCH v1] lib:Remove repeated initialization Wang Ming
  2023-07-06 14:45 ` Matthew Wilcox
@ 2023-07-06 19:42 ` Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2023-07-06 19:42 UTC (permalink / raw)
  To: Wang Ming, opensource.kernel
  Cc: LKML, kernel-janitors, linux-mm, Liam R. Howlett

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-06 19:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-06 14:03 [PATCH v1] lib:Remove repeated initialization Wang Ming
2023-07-06 14:45 ` Matthew Wilcox
2023-07-06 19:42 ` [PATCH] lib: Remove repeated “initialization” in check_state_handling() Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox