libbpf: Remove redundant non-null checks on obj_elf
authorGaosheng Cui <cuigaosheng1@huawei.com>
Thu, 21 Apr 2022 03:18:03 +0000 (11:18 +0800)
committerAndrii Nakryiko <andrii@kernel.org>
Thu, 21 Apr 2022 16:56:26 +0000 (09:56 -0700)
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>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220421031803.2283974-1-cuigaosheng1@huawei.com
tools/lib/bpf/libbpf.c

index 94940497354bd5d7d719df66bd493bad4ecf587a..873a29ce7781acebbf26dbbbad9d86d9fc87cf56 100644 (file)
@@ -1233,10 +1233,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;