Blob Blame History Raw
From: Gaosheng Cui <cuigaosheng1@huawei.com>
Date: Thu, 21 Apr 2022 11:18:03 +0800
Subject: libbpf: Remove redundant non-null checks on obj_elf
Patch-mainline: v5.19-rc1
Git-commit: b71a2ebf74ef509b6b6926c78549e183c3b63947
References: jsc#PED-1377

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
Acked-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
---
 tools/lib/bpf/libbpf.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1233,10 +1233,8 @@ static void bpf_object__elf_finish(struc
 	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;