[PATCH linux-next] lib: Remove redundant statement

From: luo penghao
Date: Mon Oct 18 2021 - 04:56:52 EST


Regardless of whether the next if condition causes the function to return,
the assignment operation is meaningless.

The clang_analyzer complains as follows:

lib/assoc_array.c:97:3 warning:
lib/assoc_array.c:409:3 warning:

Value stored to 'cursor' is never read.

Reported-by: Zeal Robot <zealci@xxxxxxxxxx>>
Signed-off-by: luo penghao <luo.penghao@xxxxxxxxxx>
---
lib/assoc_array.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/lib/assoc_array.c b/lib/assoc_array.c
index 079c72e..2743bca 100644
--- a/lib/assoc_array.c
+++ b/lib/assoc_array.c
@@ -94,7 +94,6 @@ static int assoc_array_subtree_iterate(const struct assoc_array_ptr *root,

if (assoc_array_ptr_is_shortcut(parent)) {
shortcut = assoc_array_ptr_to_shortcut(parent);
- cursor = parent;
parent = READ_ONCE(shortcut->back_pointer); /* Address dependency. */
slot = shortcut->parent_slot;
if (parent == stop)
@@ -406,7 +405,6 @@ static void assoc_array_destroy_subtree(struct assoc_array_ptr *root,
if (assoc_array_ptr_is_shortcut(parent)) {
shortcut = assoc_array_ptr_to_shortcut(parent);
BUG_ON(shortcut->next_node != cursor);
- cursor = parent;
parent = shortcut->back_pointer;
slot = shortcut->parent_slot;
pr_devel("free shortcut\n");
--
2.15.2