* [PATCH bpf-next] bpf: Remove an unnecessary check.
@ 2024-02-03 5:51 thinker.li
2024-02-04 18:15 ` Yonghong Song
2024-02-05 18:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: thinker.li @ 2024-02-03 5:51 UTC (permalink / raw)
To: bpf, ast, martin.lau, song, kernel-team, andrii
Cc: sinquersw, kuifeng, Kui-Feng Lee
From: Kui-Feng Lee <thinker.li@gmail.com>
The "i" here is always equal to "btf_type_vlen(t)" since
the "for_each_member()" loop never breaks.
Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
---
kernel/bpf/bpf_struct_ops.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/kernel/bpf/bpf_struct_ops.c b/kernel/bpf/bpf_struct_ops.c
index 0decd862dfe0..f98f580de77a 100644
--- a/kernel/bpf/bpf_struct_ops.c
+++ b/kernel/bpf/bpf_struct_ops.c
@@ -189,20 +189,17 @@ int bpf_struct_ops_desc_init(struct bpf_struct_ops_desc *st_ops_desc,
}
}
- if (i == btf_type_vlen(t)) {
- if (st_ops->init(btf)) {
- pr_warn("Error in init bpf_struct_ops %s\n",
- st_ops->name);
- return -EINVAL;
- } else {
- st_ops_desc->type_id = type_id;
- st_ops_desc->type = t;
- st_ops_desc->value_id = value_id;
- st_ops_desc->value_type = btf_type_by_id(btf,
- value_id);
- }
+ if (st_ops->init(btf)) {
+ pr_warn("Error in init bpf_struct_ops %s\n",
+ st_ops->name);
+ return -EINVAL;
}
+ st_ops_desc->type_id = type_id;
+ st_ops_desc->type = t;
+ st_ops_desc->value_id = value_id;
+ st_ops_desc->value_type = btf_type_by_id(btf, value_id);
+
return 0;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH bpf-next] bpf: Remove an unnecessary check.
2024-02-03 5:51 [PATCH bpf-next] bpf: Remove an unnecessary check thinker.li
@ 2024-02-04 18:15 ` Yonghong Song
2024-02-05 18:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Yonghong Song @ 2024-02-04 18:15 UTC (permalink / raw)
To: thinker.li, bpf, ast, martin.lau, song, kernel-team, andrii
Cc: sinquersw, kuifeng
On 2/2/24 9:51 PM, thinker.li@gmail.com wrote:
> From: Kui-Feng Lee <thinker.li@gmail.com>
>
> The "i" here is always equal to "btf_type_vlen(t)" since
> the "for_each_member()" loop never breaks.
>
> Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH bpf-next] bpf: Remove an unnecessary check.
2024-02-03 5:51 [PATCH bpf-next] bpf: Remove an unnecessary check thinker.li
2024-02-04 18:15 ` Yonghong Song
@ 2024-02-05 18:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-02-05 18:40 UTC (permalink / raw)
To: Kui-Feng Lee
Cc: bpf, ast, martin.lau, song, kernel-team, andrii, sinquersw,
kuifeng
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Martin KaFai Lau <martin.lau@kernel.org>:
On Fri, 2 Feb 2024 21:51:19 -0800 you wrote:
> From: Kui-Feng Lee <thinker.li@gmail.com>
>
> The "i" here is always equal to "btf_type_vlen(t)" since
> the "for_each_member()" loop never breaks.
>
> Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
>
> [...]
Here is the summary with links:
- [bpf-next] bpf: Remove an unnecessary check.
https://git.kernel.org/bpf/bpf-next/c/df9705eaa0ba
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-05 18:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-03 5:51 [PATCH bpf-next] bpf: Remove an unnecessary check thinker.li
2024-02-04 18:15 ` Yonghong Song
2024-02-05 18:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox