libbpf: streamline ELF parsing error-handling
authorAndrii Nakryiko <andriin@fb.com>
Mon, 17 Jun 2019 19:26:52 +0000 (12:26 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 17 Jun 2019 22:10:39 +0000 (00:10 +0200)
commit01b29d1dc9a06e2cdc6a0172d35605eb0300ecb2
tree32c3601baec04859f7cf3722b39c61b4434e1016
parent9c6660d0406f8c32d21957ca9853108513bea8b1
libbpf: streamline ELF parsing error-handling

Simplify ELF parsing logic by exiting early, as there is no common clean
up path to execute. That makes it unnecessary to track when err was set
and when it was cleared. It also reduces nesting in some places.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/lib/bpf/libbpf.c