libbpf: Simplify BTF initialization logic
authorAndrii Nakryiko <andriin@fb.com>
Fri, 17 Jan 2020 06:07:59 +0000 (22:07 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 17 Jan 2020 16:33:18 +0000 (08:33 -0800)
commitb7d7f3e185b6e643dcd49d1486b11cade8519008
tree2eeca14116e1f2fdf5df051c0945109f6ced3e05
parentbc0eb9a333918d2cc4f42f7f4cf09eaf029ac9de
libbpf: Simplify BTF initialization logic

Current implementation of bpf_object's BTF initialization is very convoluted
and thus prone to errors. It doesn't have to be like that. This patch
simplifies it significantly.

This code also triggered static analysis issues over logically dead code due
to redundant error checks. This simplification should fix that as well.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200117060801.1311525-3-andriin@fb.com
tools/lib/bpf/libbpf.c