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

Subsystems: bpf [general] (safe dynamic programs and tools), bpf [library] (libbpf), the rest

STALE1880d LANDED

Landed in mainline as 3b3af91cb689 on 2021-06-11.

3 messages, 3 authors, 2021-06-15 · open the first message on its own page

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

From: Wang Hai <hidden>
Date: 2021-06-09 11:57:51

There is no need for special treatment of the 'ret == 0' case.
This patch simplifies the return expression.

Signed-off-by: Wang Hai <redacted>
---
 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 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)
-- 
2.17.1

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

From: Yonghong Song <hidden>
Date: 2021-06-09 15:21:22


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 <redacted>
Acked-by: Yonghong Song <redacted>

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

From: Andrii Nakryiko <hidden>
Date: 2021-06-15 06:24:41

On Wed, Jun 9, 2021 at 8:21 AM Yonghong Song [off-list ref] wrote:


On 6/9/21 4:56 AM, Wang Hai wrote:
quoted
There is no need for special treatment of the 'ret == 0' case.
This patch simplifies the return expression.

Signed-off-by: Wang Hai <redacted>
Acked-by: Yonghong Song <redacted>
Applied to bpf-next a few days ago. Seems like patchbot was off duty
at that time.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help