diff mbox series

[v1] selftests/bpf: Fix unnecessary conversion to bool in 'run_subtest'

Message ID 20241117102857.198803-1-guanjing@cmss.chinamobile.com (mailing list archive)
State New
Headers show
Series [v1] selftests/bpf: Fix unnecessary conversion to bool in 'run_subtest' | expand

Commit Message

guanjing Nov. 17, 2024, 10:28 a.m. UTC
Fixes the following coccicheck:

tools/testing/selftests/bpf/test_loader.c:1033:64-69: WARNING: conversion to bool not needed here

Fixes: 80a4129fcf20 ("selftests/bpf: Add unit tests for bpf_arena_alloc/free_pages")
Signed-off-by: guanjing <guanjing@cmss.chinamobile.com>
---
 tools/testing/selftests/bpf/test_loader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

John Fastabend Nov. 21, 2024, 6:38 a.m. UTC | #1
guanjing wrote:
> Fixes the following coccicheck:
> 
> tools/testing/selftests/bpf/test_loader.c:1033:64-69: WARNING: conversion to bool not needed here
> 
> Fixes: 80a4129fcf20 ("selftests/bpf: Add unit tests for bpf_arena_alloc/free_pages")
> Signed-off-by: guanjing <guanjing@cmss.chinamobile.com>
> ---

I'll argue this is bpf-next and no need for a fixes tag here.

>  tools/testing/selftests/bpf/test_loader.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/bpf/test_loader.c b/tools/testing/selftests/bpf/test_loader.c
> index 3e9b009580d4..400f56f81272 100644
> --- a/tools/testing/selftests/bpf/test_loader.c
> +++ b/tools/testing/selftests/bpf/test_loader.c
> @@ -1030,7 +1030,7 @@ void run_subtest(struct test_loader *tester,
>  		}
>  
>  		do_prog_test_run(bpf_program__fd(tprog), &retval,
> -				 bpf_program__type(tprog) == BPF_PROG_TYPE_SYSCALL ? true : false);
> +				 bpf_program__type(tprog) == BPF_PROG_TYPE_SYSCALL);
>  		if (retval != subspec->retval && subspec->retval != POINTER_VALUE) {
>  			PRINT_FAIL("Unexpected retval: %d != %d\n", retval, subspec->retval);
>  			goto tobj_cleanup;
> -- 
> 2.33.0
> 
> 
>
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/test_loader.c b/tools/testing/selftests/bpf/test_loader.c
index 3e9b009580d4..400f56f81272 100644
--- a/tools/testing/selftests/bpf/test_loader.c
+++ b/tools/testing/selftests/bpf/test_loader.c
@@ -1030,7 +1030,7 @@  void run_subtest(struct test_loader *tester,
 		}
 
 		do_prog_test_run(bpf_program__fd(tprog), &retval,
-				 bpf_program__type(tprog) == BPF_PROG_TYPE_SYSCALL ? true : false);
+				 bpf_program__type(tprog) == BPF_PROG_TYPE_SYSCALL);
 		if (retval != subspec->retval && subspec->retval != POINTER_VALUE) {
 			PRINT_FAIL("Unexpected retval: %d != %d\n", retval, subspec->retval);
 			goto tobj_cleanup;