mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com,
	mingo@redhat.com, peterz@infradead.org,
	masami.hiramatsu.pt@hitachi.com, fweisbec@gmail.com,
	ming.m.lin@intel.com, tglx@linutronix.de, mingo@elte.hu
Subject: [tip:perf/urgent] perf probe: Fix to remove redundant close
Date: Wed, 6 Apr 2011 11:13:14 GMT	[thread overview]
Message-ID: <tip-f0c4801a17cb1a762bed39a6a9d5e5be33d8a340@git.kernel.org> (raw)
In-Reply-To: <20110330092547.2132.93728.stgit@ltc236.sdl.hitachi.co.jp>

Commit-ID:  f0c4801a17cb1a762bed39a6a9d5e5be33d8a340
Gitweb:     http://git.kernel.org/tip/f0c4801a17cb1a762bed39a6a9d5e5be33d8a340
Author:     Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
AuthorDate: Wed, 30 Mar 2011 18:25:47 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 5 Apr 2011 15:35:16 -0300

perf probe: Fix to remove redundant close

Since dwfl_end() closes given fd with dwfl, caller doesn't need to close its fd
when finishing process.

Cc: 2nddept-manager@sdl.hitachi.co.jp
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <20110330092547.2132.93728.stgit@ltc236.sdl.hitachi.co.jp>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/probe-event.c  |    3 ---
 tools/perf/util/probe-finder.c |    2 ++
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 5ddee66..a372d74 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -234,7 +234,6 @@ static int try_to_find_probe_trace_events(struct perf_probe_event *pev,
 
 	/* Searching trace events corresponding to probe event */
 	ntevs = find_probe_trace_events(fd, pev, tevs, max_tevs);
-	close(fd);
 
 	if (ntevs > 0) {	/* Succeeded to find trace events */
 		pr_debug("find %d probe_trace_events.\n", ntevs);
@@ -388,7 +387,6 @@ int show_line_range(struct line_range *lr, const char *module)
 	}
 
 	ret = find_line_range(fd, lr);
-	close(fd);
 	if (ret == 0) {
 		pr_warning("Specified source line is not found.\n");
 		return -ENOENT;
@@ -524,7 +522,6 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs,
 		ret = show_available_vars_at(fd, &pevs[i], max_vls, _filter,
 					     externs);
 
-	close(fd);
 	return ret;
 }
 
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 3bcd140..5473f11 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -1455,6 +1455,7 @@ static int find_probes(int fd, struct probe_finder *pf)
 	if (!dbg) {
 		pr_warning("No debug information found in the vmlinux - "
 			"please rebuild with CONFIG_DEBUG_INFO=y.\n");
+		close(fd);	/* Without dwfl_end(), fd isn't closed. */
 		return -EBADF;
 	}
 
@@ -1900,6 +1901,7 @@ int find_line_range(int fd, struct line_range *lr)
 	if (!dbg) {
 		pr_warning("No debug information found in the vmlinux - "
 			"please rebuild with CONFIG_DEBUG_INFO=y.\n");
+		close(fd);	/* Without dwfl_end(), fd isn't closed. */
 		return -EBADF;
 	}
 

  reply	other threads:[~2011-04-06 11:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-30  9:25 [PATCH -tip 00/12] Perf probe bugfixes and debuginfo object Masami Hiramatsu
2011-03-30  9:25 ` [PATCH -tip 01/12] [BUGFIX]perf probe: Fix to ensure function declared file Masami Hiramatsu
2011-04-06 11:12   ` [tip:perf/urgent] perf " tip-bot for Masami Hiramatsu
2011-03-30  9:25 ` [PATCH -tip 02/12] [BUGFIX]perf probe: Fix to remove redundant close Masami Hiramatsu
2011-04-06 11:13   ` tip-bot for Masami Hiramatsu [this message]
2011-03-30  9:25 ` [PATCH -tip 03/12] [BUGFIX]perf probe: Fix multiple --vars options behavior Masami Hiramatsu
2011-04-06 11:13   ` [tip:perf/urgent] perf " tip-bot for Masami Hiramatsu
2011-03-30  9:25 ` [PATCH -tip 04/12] [BUGFIX]perf probe: Fix to find recursively inlined function Masami Hiramatsu
2011-04-06 11:14   ` [tip:perf/urgent] perf " tip-bot for Masami Hiramatsu
2011-03-30  9:26 ` [PATCH -tip 05/12] [BUGFIX]perf probe: Fix listing incorrect line number with inline function Masami Hiramatsu
2011-04-06 11:14   ` [tip:perf/urgent] perf " tip-bot for Masami Hiramatsu
2011-03-30  9:26 ` [PATCH -tip 06/12] [CLEANUP]perf probe: Rename DIE_FIND_CB_FOUND to DIE_FIND_CB_END Masami Hiramatsu
2011-03-30  9:26 ` [PATCH -tip 07/12] [CLEANUP]perf probe: Move strtailcmp to string.c Masami Hiramatsu
2011-03-30  9:26 ` [PATCH -tip 08/12] [CLEANUP]perf probe: Remove redundant dwarf functions Masami Hiramatsu
2011-03-30  9:26 ` [PATCH -tip 09/12] [CLEANUP]perf-probe: Move dwarf library routines to dwarf-aux.{c, h} Masami Hiramatsu
2011-03-30  9:26 ` [PATCH -tip 10/12] perf probe: Warn when more than two lines are given Masami Hiramatsu
2011-03-30  9:26 ` [PATCH -tip 11/12] perf probe: Introduce debuginfo to encapsulate dwarf information Masami Hiramatsu
2011-03-30  9:26 ` [PATCH -tip 12/12] perf: Export debuginfo object without dwarf support Masami Hiramatsu

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=tip-f0c4801a17cb1a762bed39a6a9d5e5be33d8a340@git.kernel.org \
    --to=masami.hiramatsu.pt@hitachi.com \
    --cc=acme@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=ming.m.lin@intel.com \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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

Powered by JetHome