[PATCH mptcp-next 09/11] selftests: mptcp: join: avoid declaring i if not used

Matthieu Baerts (NGI0) posted 11 patches 1 week, 6 days ago
[PATCH mptcp-next 09/11] selftests: mptcp: join: avoid declaring i if not used
Posted by Matthieu Baerts (NGI0) 1 week, 6 days ago
A few loops were declaring 'i', but this variable was not used.

To avoid confusions, use '_' instead: it is more explicit to mark that
this variable is not needed.

Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 80e03168b419..4ca4bdfea246 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -603,8 +603,7 @@ wait_rm_addr()
 	local old_cnt="${2}"
 	local cnt
 
-	local i
-	for i in $(seq 10); do
+	for _ in $(seq 10); do
 		cnt=$(rm_addr_count ${ns})
 		[ "$cnt" = "${old_cnt}" ] || break
 		sleep 0.1
@@ -623,8 +622,7 @@ wait_rm_sf()
 	local old_cnt="${2}"
 	local cnt
 
-	local i
-	for i in $(seq 10); do
+	for _ in $(seq 10); do
 		cnt=$(rm_sf_count ${ns})
 		[ "$cnt" = "${old_cnt}" ] || break
 		sleep 0.1
@@ -648,8 +646,7 @@ wait_ll_ready()
 {
 	local ns="${1}"
 
-	local i
-	for i in $(seq 50); do
+	for _ in $(seq 50); do
 		ip -n "${ns}" -6 addr show scope link | grep "inet6 fe80" |
 			grep -qw "tentative" || break
 		sleep 0.1

-- 
2.51.0
Re: [PATCH mptcp-next 09/11] selftests: mptcp: join: avoid declaring i if not used
Posted by Geliang Tang 1 week, 4 days ago
On Fri, 2025-12-26 at 07:40 +0100, Matthieu Baerts (NGI0) wrote:
> A few loops were declaring 'i', but this variable was not used.
> 
> To avoid confusions, use '_' instead: it is more explicit to mark
> that
> this variable is not needed.
> 
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>

    Reviewed-by: Geliang Tang <geliang@kernel.org>

Thanks,
-Geliang

> ---
>  tools/testing/selftests/net/mptcp/mptcp_join.sh | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> index 80e03168b419..4ca4bdfea246 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> @@ -603,8 +603,7 @@ wait_rm_addr()
>  	local old_cnt="${2}"
>  	local cnt
>  
> -	local i
> -	for i in $(seq 10); do
> +	for _ in $(seq 10); do
>  		cnt=$(rm_addr_count ${ns})
>  		[ "$cnt" = "${old_cnt}" ] || break
>  		sleep 0.1
> @@ -623,8 +622,7 @@ wait_rm_sf()
>  	local old_cnt="${2}"
>  	local cnt
>  
> -	local i
> -	for i in $(seq 10); do
> +	for _ in $(seq 10); do
>  		cnt=$(rm_sf_count ${ns})
>  		[ "$cnt" = "${old_cnt}" ] || break
>  		sleep 0.1
> @@ -648,8 +646,7 @@ wait_ll_ready()
>  {
>  	local ns="${1}"
>  
> -	local i
> -	for i in $(seq 50); do
> +	for _ in $(seq 50); do
>  		ip -n "${ns}" -6 addr show scope link | grep "inet6
> fe80" |
>  			grep -qw "tentative" || break
>  		sleep 0.1