Skip to contentSkip to conversation

libbpf: simplify the return expression of bpf_object__init_maps function

PATCH Applied Wang Hai 3 participants 3 messages Jun 9, 2021 – Jun 15, 2021

Subsystems (4)
lore
Share & tools
lore

Wang Hai

author
#0 lore raw

PATCH 1/1 libbpf: simplify the return expression of bpf_object__init_maps function

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

---
 tools/lib/bpf/libbpf.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
tools/lib/bpf/libbpf.c +1 -3
index c41d9b2b59ac..e49fcac45fdc 100644
@@ -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)
Signature · 1 line
2.17.1