bpf: move warning in btf_load_into_kernel
PATCH 1/1 bpf: move warning in btf_load_into_kernel
When BTF fails to load, only show the warning for callers that didn't supply a log_buf. This will remove an unneeded warning for users loading BPF programs (via bpf_object__sanitize_and_load_btf) on kernels that don't require BTF.
This also assumes that callers providing a log_buf know what they're doing.
Signed-off-by Jordan Rome <[email protected]>
--- tools/lib/bpf/btf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/lib/bpf/btf.c +3 -2
@@ -1447,10 +1447,11 @@ int btf_load_into_kernel(struct btf *btf, goto retry_load; err = -errno; -pr_warn ("BTF loading error: %s\n" ,errstr (err));/* don't print out contents of custom log_buf */ -if (!log_buf && buf[0 ]) +if (!log_buf && buf[0 ]) { +pr_warn ("BTF loading error: %s\n" ,errstr (err));pr_warn ("-- BEGIN BTF LOAD LOG ---\n%s\n-- END BTF LOAD LOG --\n" , buf); + } } done:
--
2.43.5