bpf: Remove an unnecessary check.
PATCH 1/1 bpf: Remove an unnecessary check.
From: Kui-Feng Lee <[email protected]>
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 <[email protected]>
--- kernel/bpf/bpf_struct_ops.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)
kernel/bpf/bpf_struct_ops.c +9 -12
@@ -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 ; }
Signature · 1 line
2.34.1
Quoted 6 lines · On 2/2/24 9:51 PM, [email protected] wrote:
From: Kui-Feng Lee <[email protected]>
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 <[email protected]>
Acked-by Yonghong Song <[email protected]>
This patch was applied to bpf/bpf-next.git (master) by Martin KaFai Lau <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Martin KaFai Lau <[email protected]>:
Quoted 8 lines · On Fri, 2 Feb 2024 21:51:19 -0800 you wrote:
From: Kui-Feng Lee <[email protected]>
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 <[email protected]>[...]
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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html