From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> Date: Sat, 30 Dec 2023 19:00:12 +0100 Move one assignment for the variable “st_map” closer to the place where this pointer is used. Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> --- kernel/bpf/bpf_struct_ops.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/bpf/bpf_struct_ops.c b/kernel/bpf/bpf_struct_ops.c index b49ea460d616..4133d65c2a28 100644 --- a/kernel/bpf/bpf_struct_ops.c +++ b/kernel/bpf/bpf_struct_ops.c @@ -898,8 +898,6 @@ int bpf_struct_ops_link_create(union bpf_attr *attr) if (IS_ERR(map)) return PTR_ERR(map); - st_map = (struct bpf_struct_ops_map *)map; - if (!bpf_struct_ops_valid_to_reg(map)) { err = -EINVAL; goto put_map; @@ -916,6 +914,7 @@ int bpf_struct_ops_link_create(union bpf_attr *attr) if (err) goto err_out; + st_map = (struct bpf_struct_ops_map *)map; err = st_map->st_ops->reg(st_map->kvalue.data); if (err) { bpf_link_cleanup(&link_primer); -- 2.43.0