summaryrefslogtreecommitdiffstats
path: root/tools/bpf
diff options
context:
space:
mode:
authorJiong Wang <jiong.wang@netronome.com>2018-03-01 18:01:16 -0800
committerAlexei Starovoitov <ast@kernel.org>2018-03-01 18:29:48 -0800
commit3197239d24dcecef1dbc260733b377ade731b748 (patch)
tree7c21cb31ba8a57160bbb32c7cd488298353ce102 /tools/bpf
parentc8745e07d5d676b2cb49f90baec1ac5e66cb7383 (diff)
downloadop-kernel-dev-3197239d24dcecef1dbc260733b377ade731b748.zip
op-kernel-dev-3197239d24dcecef1dbc260733b377ade731b748.tar.gz
tools: bpftool: remove unnecessary 'if' to reduce indentation
It is obvious we could use 'else if' instead of start a new 'if' in the touched code. Signed-off-by: Jiong Wang <jiong.wang@netronome.com> Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/bpf')
-rw-r--r--tools/bpf/bpftool/prog.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index e549e32..950d11d 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -777,27 +777,25 @@ static int do_dump(int argc, char **argv)
if (json_output)
jsonw_null(json_wtr);
- } else {
- if (member_len == &info.jited_prog_len) {
- const char *name = NULL;
-
- if (info.ifindex) {
- name = ifindex_to_bfd_name_ns(info.ifindex,
- info.netns_dev,
- info.netns_ino);
- if (!name)
- goto err_free;
- }
-
- disasm_print_insn(buf, *member_len, opcodes, name);
- } else {
- kernel_syms_load(&dd);
- if (json_output)
- dump_xlated_json(&dd, buf, *member_len, opcodes);
- else
- dump_xlated_plain(&dd, buf, *member_len, opcodes);
- kernel_syms_destroy(&dd);
+ } else if (member_len == &info.jited_prog_len) {
+ const char *name = NULL;
+
+ if (info.ifindex) {
+ name = ifindex_to_bfd_name_ns(info.ifindex,
+ info.netns_dev,
+ info.netns_ino);
+ if (!name)
+ goto err_free;
}
+
+ disasm_print_insn(buf, *member_len, opcodes, name);
+ } else {
+ kernel_syms_load(&dd);
+ if (json_output)
+ dump_xlated_json(&dd, buf, *member_len, opcodes);
+ else
+ dump_xlated_plain(&dd, buf, *member_len, opcodes);
+ kernel_syms_destroy(&dd);
}
free(buf);
OpenPOWER on IntegriCloud