Skip to contentSkip to conversation

lib/test_rhashtable: Remove set but unused variable 'insert_retries'

PATCH Applied Jiapeng Chong 3 participants 3 messages Nov 23, 2022 – Nov 25, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 lib/test_rhashtable: Remove set but unused variable 'insert_retries'

Variable 'insert_retries' is not effectively used in the function, so delete it.

lib/test_rhashtable.c:437:18: warning: variable 'insert_retries' set but not used.

---
Changes in v2:
-The condition for modifying err is less than 0.

 lib/test_rhashtable.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
lib/test_rhashtable.c +2 -4
index 6a8e445c8b55..c20f6cb4bf55 100644
@@ -434,7 +434,7 @@ static int __init test_rhltable(unsigned int entries)
 static int __init test_rhashtable_max(struct test_obj *array,
 				      unsigned int entries)
 {
-	unsigned int i, insert_retries = 0;
+	unsigned int i;
 	int err;
 
 	test_rht_params.max_size = roundup_pow_of_two(entries / 8);
@@ -447,9 +447,7 @@ static int __init test_rhashtable_max(struct test_obj *array,
 
 		obj->value.id = i * 2;
 		err = insert_retry(&ht, obj, test_rht_params);
-		if (err > 0)
-			insert_retries += err;
-		else if (err)
+		if (err < 0)
 			return err;
 	}
 
Signature · 1 line
2.20.1.7.g153144c
maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 8 lines · Jiapeng Chong

Variable 'insert_retries' is not effectively used in the function, so delete it.

lib/test_rhashtable.c:437:18: warning: variable 'insert_retries' set but not used.

Quoted 6 lines

---
Changes in v2:
-The condition for modifying err is less than 0.

 lib/test_rhashtable.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Thanks,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#2 lore raw
In reply to Jiapeng Chong
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Quoted 10 lines · On Wed, 23 Nov 2022 17:37:02 +0800 you wrote:

Variable 'insert_retries' is not effectively used in the function, so delete it.

lib/test_rhashtable.c:437:18: warning: variable 'insert_retries' set but not used.

[...]

Here is the summary with links:
- [v2] lib/test_rhashtable: Remove set but unused variable 'insert_retries'

    https://git.kernel.org/netdev/net-next/c/b084f6cc3563

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html