diff mbox series

[bpf-next] libbpf: simplify the return expression of bpf_object__init_maps function

Message ID 20210609115651.3392580-1-wanghai38@huawei.com (mailing list archive)
State Accepted
Delegated to: BPF
Headers show
Series [bpf-next] libbpf: simplify the return expression of bpf_object__init_maps function | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for bpf-next
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 10 of 10 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Wang Hai June 9, 2021, 11:56 a.m. UTC
There is no need for special treatment of the 'ret == 0' case.
This patch simplifies the return expression.

Signed-off-by: Wang Hai <wanghai38@huawei.com>
---
 tools/lib/bpf/libbpf.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Yonghong Song June 9, 2021, 3:20 p.m. UTC | #1
On 6/9/21 4:56 AM, Wang Hai wrote:
> There is no need for special treatment of the 'ret == 0' case.
> This patch simplifies the return expression.
> 
> Signed-off-by: Wang Hai <wanghai38@huawei.com>

Acked-by: Yonghong Song <yhs@fb.com>
Andrii Nakryiko June 15, 2021, 6:24 a.m. UTC | #2
On Wed, Jun 9, 2021 at 8:21 AM Yonghong Song <yhs@fb.com> wrote:
>
>
>
> On 6/9/21 4:56 AM, Wang Hai wrote:
> > There is no need for special treatment of the 'ret == 0' case.
> > This patch simplifies the return expression.
> >
> > Signed-off-by: Wang Hai <wanghai38@huawei.com>
>
> Acked-by: Yonghong Song <yhs@fb.com>

Applied to bpf-next a few days ago. Seems like patchbot was off duty
at that time.
diff mbox series

Patch

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index c41d9b2b59ac..e49fcac45fdc 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -2425,10 +2425,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)