[PATCH v2] selftests: arm64: Fix -Waddress warning in tpidr2 test

Bala-Vignesh-Reddy posted 1 patch 1 month, 4 weeks ago
tools/testing/selftests/arm64/abi/tpidr2.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
[PATCH v2] selftests: arm64: Fix -Waddress warning in tpidr2 test
Posted by Bala-Vignesh-Reddy 1 month, 4 weeks ago
Resolve compiler warning about always true condition in ksft_test_result
in tpidr2, passing actual function.

This silences -Waddress warning while maintaining test functionality.

Fixes compiler warning (similar for other functions):
warning: the address of 'write_read' will always evaluate as
'true' [-Waddress]

Fixes: 6d80cb73131d ("kselftest/arm64: Convert tpidr2 test to use kselftest.h")

Signed-off-by: Bala-Vignesh-Reddy <reddybalavignesh9979@gmail.com>
---
 tools/testing/selftests/arm64/abi/tpidr2.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/arm64/abi/tpidr2.c b/tools/testing/selftests/arm64/abi/tpidr2.c
index f58a9f89b952..4c89ab0f1010 100644
--- a/tools/testing/selftests/arm64/abi/tpidr2.c
+++ b/tools/testing/selftests/arm64/abi/tpidr2.c
@@ -227,10 +227,10 @@ int main(int argc, char **argv)
 	ret = open("/proc/sys/abi/sme_default_vector_length", O_RDONLY, 0);
 	if (ret >= 0) {
 		ksft_test_result(default_value(), "default_value\n");
-		ksft_test_result(write_read, "write_read\n");
-		ksft_test_result(write_sleep_read, "write_sleep_read\n");
-		ksft_test_result(write_fork_read, "write_fork_read\n");
-		ksft_test_result(write_clone_read, "write_clone_read\n");
+		ksft_test_result(write_read(), "write_read\n");
+		ksft_test_result(write_sleep_read(), "write_sleep_read\n");
+		ksft_test_result(write_fork_read(), "write_fork_read\n");
+		ksft_test_result(write_clone_read(), "write_clone_read\n");
 
 	} else {
 		ksft_print_msg("SME support not present\n");
-- 
2.43.0
Re: [PATCH v2] selftests: arm64: Fix -Waddress warning in tpidr2 test
Posted by Will Deacon 3 weeks, 5 days ago
On Thu, 07 Aug 2025 17:12:29 +0530, Bala-Vignesh-Reddy wrote:
> Resolve compiler warning about always true condition in ksft_test_result
> in tpidr2, passing actual function.
> 
> This silences -Waddress warning while maintaining test functionality.
> 
> Fixes compiler warning (similar for other functions):
> warning: the address of 'write_read' will always evaluate as
> 'true' [-Waddress]
> 
> [...]

Applied to arm64 (for-next/selftests), thanks!

[1/1] selftests: arm64: Fix -Waddress warning in tpidr2 test
      https://git.kernel.org/arm64/c/50af02425afc

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
Re: [PATCH v2] selftests: arm64: Fix -Waddress warning in tpidr2 test
Posted by Anshuman Khandual 1 month, 3 weeks ago
On 07/08/25 5:12 PM, Bala-Vignesh-Reddy wrote:
> Resolve compiler warning about always true condition in ksft_test_result
> in tpidr2, passing actual function.
> 
> This silences -Waddress warning while maintaining test functionality.
> 
> Fixes compiler warning (similar for other functions):
> warning: the address of 'write_read' will always evaluate as
> 'true' [-Waddress]
> 
> Fixes: 6d80cb73131d ("kselftest/arm64: Convert tpidr2 test to use kselftest.h")
> 
> Signed-off-by: Bala-Vignesh-Reddy <reddybalavignesh9979@gmail.com>
> ---
>  tools/testing/selftests/arm64/abi/tpidr2.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/testing/selftests/arm64/abi/tpidr2.c b/tools/testing/selftests/arm64/abi/tpidr2.c
> index f58a9f89b952..4c89ab0f1010 100644
> --- a/tools/testing/selftests/arm64/abi/tpidr2.c
> +++ b/tools/testing/selftests/arm64/abi/tpidr2.c
> @@ -227,10 +227,10 @@ int main(int argc, char **argv)
>  	ret = open("/proc/sys/abi/sme_default_vector_length", O_RDONLY, 0);
>  	if (ret >= 0) {
>  		ksft_test_result(default_value(), "default_value\n");
> -		ksft_test_result(write_read, "write_read\n");
> -		ksft_test_result(write_sleep_read, "write_sleep_read\n");
> -		ksft_test_result(write_fork_read, "write_fork_read\n");
> -		ksft_test_result(write_clone_read, "write_clone_read\n");
> +		ksft_test_result(write_read(), "write_read\n");
> +		ksft_test_result(write_sleep_read(), "write_sleep_read\n");
> +		ksft_test_result(write_fork_read(), "write_fork_read\n");
> +		ksft_test_result(write_clone_read(), "write_clone_read\n");
>  
>  	} else {
>  		ksft_print_msg("SME support not present\n");

LGTM

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Re: [PATCH v2] selftests: arm64: Fix -Waddress warning in tpidr2 test
Posted by Mark Brown 1 month, 4 weeks ago
On Thu, Aug 07, 2025 at 05:12:29PM +0530, Bala-Vignesh-Reddy wrote:
> Resolve compiler warning about always true condition in ksft_test_result
> in tpidr2, passing actual function.
> 
> This silences -Waddress warning while maintaining test functionality.

Not just maintaining, it fixes it.

Reviewed-by: Mark Brown <broonie@kernel.org>