Message ID | 20220421031803.2283974-1-cuigaosheng1@huawei.com (mailing list archive) |
---|---|
State | Accepted |
Commit | b71a2ebf74ef509b6b6926c78549e183c3b63947 |
Delegated to: | BPF |
Headers | show |
Series | [-next] libbpf: Remove redundant non-null checks on obj_elf | expand |
Context | Check | Description |
---|---|---|
bpf/vmtest-bpf-next-PR | success | PR summary |
bpf/vmtest-bpf-next-VM_Test-1 | success | Logs for Kernel LATEST on ubuntu-latest + selftests |
bpf/vmtest-bpf-next-VM_Test-2 | success | Logs for Kernel LATEST on z15 + selftests |
netdev/tree_selection | success | Not a local patch |
Hello: This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <andrii@kernel.org>: On Thu, 21 Apr 2022 11:18:03 +0800 you wrote: > Obj_elf is already non-null checked at the function entry, so remove > redundant non-null checks on obj_elf. > > Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com> > --- > tools/lib/bpf/libbpf.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) Here is the summary with links: - [-next] libbpf: Remove redundant non-null checks on obj_elf https://git.kernel.org/bpf/bpf-next/c/b71a2ebf74ef You are awesome, thank you!
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index bf4f7ac54ebf..b53e51884f9e 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -1222,10 +1222,8 @@ static void bpf_object__elf_finish(struct bpf_object *obj) if (!obj->efile.elf) return; - if (obj->efile.elf) { - elf_end(obj->efile.elf); - obj->efile.elf = NULL; - } + elf_end(obj->efile.elf); + obj->efile.elf = NULL; obj->efile.symbols = NULL; obj->efile.st_ops_data = NULL;
Obj_elf is already non-null checked at the function entry, so remove redundant non-null checks on obj_elf. Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com> --- tools/lib/bpf/libbpf.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)