From 55d7e99ddc8c8b37bd46be60dd09b6cd2161291e Mon Sep 17 00:00:00 2001 From: Wang Hai Date: Wed, 24 Aug 2022 11:23:08 +0800 Subject: [PATCH] libbpf: Simplify the return expression of bpf_object__init_maps function mainline inclusion from mainline-5.14-rc1 commit 3b3af91cb6893967bbec30f5c14562d0f7f00c2a category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5EUVD CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3b3af91cb6893967bbec30f5c14562d0f7f00c2a ------------------------------------------------- There is no need for special treatment of the 'ret == 0' case. This patch simplifies the return expression. Signed-off-by: Wang Hai Signed-off-by: Andrii Nakryiko Acked-by: Yonghong Song Link: https://lore.kernel.org/bpf/20210609115651.3392580-1-wanghai38@huawei.com (cherry picked from commit 3b3af91cb6893967bbec30f5c14562d0f7f00c2a) Signed-off-by: Wang Yufen --- tools/lib/bpf/libbpf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 3cb3994f91b0..64dd637af7db 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -2465,10 +2465,8 @@ static int bpf_object__init_maps(struct bpf_object *obj, err = err ?: bpf_object__init_global_data_maps(obj); err = err ?: bpf_object__init_kconfig_map(obj); err = err ?: bpf_object__init_struct_ops_maps(obj); - if (err) - return err; - return 0; + return err; } static bool section_have_execinstr(struct bpf_object *obj, int idx) -- GitLab