core/bpf-firewall: replace unnecessary unit_setup_cgroup_runtime() with unit_get_cgroup_runtime()
Except for the test, bpf_firewall_compile() is only called by the following: cgroup_context_apply() -> cgroup_apply_firewall() -> bpf_firewall_compile() and in the early stage of cgroup_context_apply(), it checks if the cgroup runtime exists. Hence, it is not necessary to try to allocate the runtime in bpf_firewall_compile().
This commit is contained in:
@@ -547,9 +547,9 @@ int bpf_firewall_compile(Unit *u) {
|
||||
if (!cc)
|
||||
return -EINVAL;
|
||||
|
||||
crt = unit_setup_cgroup_runtime(u);
|
||||
crt = unit_get_cgroup_runtime(u);
|
||||
if (!crt)
|
||||
return -ENOMEM;
|
||||
return -ESTALE;
|
||||
|
||||
if (bpf_program_supported() <= 0)
|
||||
return log_unit_debug_errno(u, SYNTHETIC_ERRNO(EOPNOTSUPP),
|
||||
|
||||
Reference in New Issue
Block a user