From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758497AbbKHHcj (ORCPT ); Sun, 8 Nov 2015 02:32:39 -0500 Received: from terminus.zytor.com ([198.137.202.10]:46074 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754782AbbKHHcd (ORCPT ); Sun, 8 Nov 2015 02:32:33 -0500 Date: Sat, 7 Nov 2015 23:32:19 -0800 From: tip-bot for Masami Hiramatsu Message-ID: Cc: lizefan@huawei.com, tglx@linutronix.de, mingo@kernel.org, masami.hiramatsu.pt@hitachi.com, jolsa@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org, namhyung@kernel.org, wangnan0@huawei.com, acme@redhat.com Reply-To: linux-kernel@vger.kernel.org, hpa@zytor.com, namhyung@kernel.org, wangnan0@huawei.com, acme@redhat.com, lizefan@huawei.com, mingo@kernel.org, masami.hiramatsu.pt@hitachi.com, tglx@linutronix.de, jolsa@kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf probe: Cleanup find_perf_probe_point_from_map to reduce redundancy Git-Commit-ID: 0a62f6869f2768687af2c94d97f3b2fcf5b73367 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 0a62f6869f2768687af2c94d97f3b2fcf5b73367 Gitweb: http://git.kernel.org/tip/0a62f6869f2768687af2c94d97f3b2fcf5b73367 Author: Masami Hiramatsu AuthorDate: Fri, 6 Nov 2015 17:30:03 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 6 Nov 2015 10:47:33 -0300 perf probe: Cleanup find_perf_probe_point_from_map to reduce redundancy 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 Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Cc: Zefan Li Link: http://lkml.kernel.org/n/tip-ufp1zgbktzmttcputozneomd@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- 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 e659c4f..03875f9 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;