From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
Wang Nan <wangnan0@huawei.com>, Zefan Li <lizefan@huawei.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 03/11] perf probe: Cleanup find_perf_probe_point_from_map to reduce redundancy
Date: Fri, 6 Nov 2015 17:54:31 -0300 [thread overview]
Message-ID: <1446843279-14825-4-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1446843279-14825-1-git-send-email-acme@kernel.org>
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
In find_perf_probe_point_from_map(), the 'ret' variable is initialized
with -ENOENT but overwritten by the return code of
kernel_get_symbol_address_by_name(), and after that it is re-initialized
with -ENOENT again.
Setting ret=-ENOENT twice looks a bit redundant. This avoids the
overwriting and just returns -ENOENT if some error happens to simplify
the code.
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Zefan Li <lizefan@huawei.com>
Link: http://lkml.kernel.org/n/tip-ufp1zgbktzmttcputozneomd@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/probe-event.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index e659c4faddec..03875f9154e7 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -1895,9 +1895,8 @@ static int find_perf_probe_point_from_map(struct probe_trace_point *tp,
sym = map__find_symbol(map, addr, NULL);
} else {
if (tp->symbol && !addr) {
- ret = kernel_get_symbol_address_by_name(tp->symbol,
- &addr, true, false);
- if (ret < 0)
+ if (kernel_get_symbol_address_by_name(tp->symbol,
+ &addr, true, false) < 0)
goto out;
}
if (addr) {
@@ -1906,8 +1905,6 @@ static int find_perf_probe_point_from_map(struct probe_trace_point *tp,
}
}
- /* ret may has be overwritten so reset it */
- ret = -ENOENT;
if (!sym)
goto out;
--
2.1.0
next prev parent reply other threads:[~2015-11-06 20:58 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-06 20:54 [GIT PULL 00/11] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-11-06 20:54 ` [PATCH 01/11] perf stat: Make stat options global Arnaldo Carvalho de Melo
2015-11-06 20:54 ` [PATCH 02/11] perf annotate: Inform the user about objdump failures in --stdio Arnaldo Carvalho de Melo
2015-11-06 20:54 ` Arnaldo Carvalho de Melo [this message]
2015-11-06 20:54 ` [PATCH 04/11] bpf tools: Improve libbpf error reporting Arnaldo Carvalho de Melo
2015-11-06 20:54 ` [PATCH 05/11] bpf tools: Add new API bpf_object__get_kversion() Arnaldo Carvalho de Melo
2015-11-06 20:54 ` [PATCH 06/11] perf tools: Make fetch_kernel_version() publicly available Arnaldo Carvalho de Melo
2015-11-06 20:54 ` [PATCH 07/11] perf bpf: Improve BPF related error messages Arnaldo Carvalho de Melo
2015-11-06 20:54 ` [PATCH 08/11] perf test: Enhance the LLVM test: update basic BPF test program Arnaldo Carvalho de Melo
2015-11-06 20:54 ` [PATCH 09/11] perf test: Enhance the LLVM tests: add kbuild test Arnaldo Carvalho de Melo
2015-11-06 20:54 ` [PATCH 10/11] perf test: Add 'perf test BPF' Arnaldo Carvalho de Melo
2015-11-06 20:54 ` [PATCH 11/11] perf test: Do not be case sensitive when searching for matching tests Arnaldo Carvalho de Melo
2015-11-08 7:24 ` [GIT PULL 00/11] perf/core improvements and fixes Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1446843279-14825-4-git-send-email-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=wangnan0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).