[PATCH] selftests/bpf: Convert comma to semicolon

Chen Ni posted 1 patch 8 months, 3 weeks ago
tools/testing/selftests/bpf/test_kmods/bpf_testmod.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] selftests/bpf: Convert comma to semicolon
Posted by Chen Ni 8 months, 3 weeks ago
Replace comma between expressions with semicolons.

Using a ',' in place of a ';' can have unintended side effects.
Although that is not the case here, it is seems best to use ';'
unless ',' is intended.

Found by inspection.
No functional change intended.
Compile tested only.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 tools/testing/selftests/bpf/test_kmods/bpf_testmod.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
index 3220f1d28697..f38eaf0d35ef 100644
--- a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
+++ b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
@@ -1340,7 +1340,7 @@ static int st_ops_gen_prologue_with_kfunc(struct bpf_insn *insn_buf, bool direct
 	*insn++ = BPF_STX_MEM(BPF_DW, BPF_REG_6, BPF_REG_7, offsetof(struct st_ops_args, a));
 	*insn++ = BPF_JMP_IMM(BPF_JA, 0, 0, 2);
 	*insn++ = BPF_MOV64_REG(BPF_REG_1, BPF_REG_0);
-	*insn++ = BPF_CALL_KFUNC(0, bpf_cgroup_release_id),
+	*insn++ = BPF_CALL_KFUNC(0, bpf_cgroup_release_id);
 	*insn++ = BPF_MOV64_REG(BPF_REG_1, BPF_REG_8);
 	*insn++ = prog->insnsi[0];
 
@@ -1379,7 +1379,7 @@ static int st_ops_gen_epilogue_with_kfunc(struct bpf_insn *insn_buf, const struc
 	*insn++ = BPF_STX_MEM(BPF_DW, BPF_REG_1, BPF_REG_6, offsetof(struct st_ops_args, a));
 	*insn++ = BPF_JMP_IMM(BPF_JA, 0, 0, 2);
 	*insn++ = BPF_MOV64_REG(BPF_REG_1, BPF_REG_0);
-	*insn++ = BPF_CALL_KFUNC(0, bpf_cgroup_release_id),
+	*insn++ = BPF_CALL_KFUNC(0, bpf_cgroup_release_id);
 	*insn++ = BPF_MOV64_REG(BPF_REG_0, BPF_REG_6);
 	*insn++ = BPF_ALU64_IMM(BPF_MUL, BPF_REG_0, 2);
 	*insn++ = BPF_EXIT_INSN();
-- 
2.25.1
Re: [PATCH] selftests/bpf: Convert comma to semicolon
Posted by Amery Hung 8 months, 3 weeks ago
On Mon, Mar 31, 2025 at 11:17 PM Chen Ni <nichen@iscas.ac.cn> wrote:
>
> Replace comma between expressions with semicolons.
>
> Using a ',' in place of a ';' can have unintended side effects.
> Although that is not the case here, it is seems best to use ';'
> unless ',' is intended.
>
> Found by inspection.
> No functional change intended.
> Compile tested only.
>

Oopsie. Thanks for fixing it.

Reviewed-by: Amery Hung <ameryhung@gmail.com>

> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
> ---
>  tools/testing/selftests/bpf/test_kmods/bpf_testmod.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
> index 3220f1d28697..f38eaf0d35ef 100644
> --- a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
> +++ b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
> @@ -1340,7 +1340,7 @@ static int st_ops_gen_prologue_with_kfunc(struct bpf_insn *insn_buf, bool direct
>         *insn++ = BPF_STX_MEM(BPF_DW, BPF_REG_6, BPF_REG_7, offsetof(struct st_ops_args, a));
>         *insn++ = BPF_JMP_IMM(BPF_JA, 0, 0, 2);
>         *insn++ = BPF_MOV64_REG(BPF_REG_1, BPF_REG_0);
> -       *insn++ = BPF_CALL_KFUNC(0, bpf_cgroup_release_id),
> +       *insn++ = BPF_CALL_KFUNC(0, bpf_cgroup_release_id);
>         *insn++ = BPF_MOV64_REG(BPF_REG_1, BPF_REG_8);
>         *insn++ = prog->insnsi[0];
>
> @@ -1379,7 +1379,7 @@ static int st_ops_gen_epilogue_with_kfunc(struct bpf_insn *insn_buf, const struc
>         *insn++ = BPF_STX_MEM(BPF_DW, BPF_REG_1, BPF_REG_6, offsetof(struct st_ops_args, a));
>         *insn++ = BPF_JMP_IMM(BPF_JA, 0, 0, 2);
>         *insn++ = BPF_MOV64_REG(BPF_REG_1, BPF_REG_0);
> -       *insn++ = BPF_CALL_KFUNC(0, bpf_cgroup_release_id),
> +       *insn++ = BPF_CALL_KFUNC(0, bpf_cgroup_release_id);
>         *insn++ = BPF_MOV64_REG(BPF_REG_0, BPF_REG_6);
>         *insn++ = BPF_ALU64_IMM(BPF_MUL, BPF_REG_0, 2);
>         *insn++ = BPF_EXIT_INSN();
> --
> 2.25.1
>