diff options
| author | Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> | 2011-03-30 05:25:47 -0400 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-04-05 14:35:16 -0400 |
| commit | f0c4801a17cb1a762bed39a6a9d5e5be33d8a340 (patch) | |
| tree | 3a3d7e446748c4367d21cbddb9ce31f509d4993c | |
| parent | 7d21635ac5c78abe162fb3f56b37c30bcbfa019f (diff) | |
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>
| -rw-r--r-- | tools/perf/util/probe-event.c | 3 | ||||
| -rw-r--r-- | 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 5ddee66020a7..a372d748644b 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, | |||
| 234 | 234 | ||
| 235 | /* Searching trace events corresponding to probe event */ | 235 | /* Searching trace events corresponding to probe event */ |
| 236 | ntevs = find_probe_trace_events(fd, pev, tevs, max_tevs); | 236 | ntevs = find_probe_trace_events(fd, pev, tevs, max_tevs); |
| 237 | close(fd); | ||
| 238 | 237 | ||
| 239 | if (ntevs > 0) { /* Succeeded to find trace events */ | 238 | if (ntevs > 0) { /* Succeeded to find trace events */ |
| 240 | pr_debug("find %d probe_trace_events.\n", ntevs); | 239 | pr_debug("find %d probe_trace_events.\n", ntevs); |
| @@ -388,7 +387,6 @@ int show_line_range(struct line_range *lr, const char *module) | |||
| 388 | } | 387 | } |
| 389 | 388 | ||
| 390 | ret = find_line_range(fd, lr); | 389 | ret = find_line_range(fd, lr); |
| 391 | close(fd); | ||
| 392 | if (ret == 0) { | 390 | if (ret == 0) { |
| 393 | pr_warning("Specified source line is not found.\n"); | 391 | pr_warning("Specified source line is not found.\n"); |
| 394 | return -ENOENT; | 392 | return -ENOENT; |
| @@ -524,7 +522,6 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs, | |||
| 524 | ret = show_available_vars_at(fd, &pevs[i], max_vls, _filter, | 522 | ret = show_available_vars_at(fd, &pevs[i], max_vls, _filter, |
| 525 | externs); | 523 | externs); |
| 526 | 524 | ||
| 527 | close(fd); | ||
| 528 | return ret; | 525 | return ret; |
| 529 | } | 526 | } |
| 530 | 527 | ||
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 3bcd140b4545..5473f11a9bc8 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) | |||
| 1455 | if (!dbg) { | 1455 | if (!dbg) { |
| 1456 | pr_warning("No debug information found in the vmlinux - " | 1456 | pr_warning("No debug information found in the vmlinux - " |
| 1457 | "please rebuild with CONFIG_DEBUG_INFO=y.\n"); | 1457 | "please rebuild with CONFIG_DEBUG_INFO=y.\n"); |
| 1458 | close(fd); /* Without dwfl_end(), fd isn't closed. */ | ||
| 1458 | return -EBADF; | 1459 | return -EBADF; |
| 1459 | } | 1460 | } |
| 1460 | 1461 | ||
| @@ -1900,6 +1901,7 @@ int find_line_range(int fd, struct line_range *lr) | |||
| 1900 | if (!dbg) { | 1901 | if (!dbg) { |
| 1901 | pr_warning("No debug information found in the vmlinux - " | 1902 | pr_warning("No debug information found in the vmlinux - " |
| 1902 | "please rebuild with CONFIG_DEBUG_INFO=y.\n"); | 1903 | "please rebuild with CONFIG_DEBUG_INFO=y.\n"); |
| 1904 | close(fd); /* Without dwfl_end(), fd isn't closed. */ | ||
| 1903 | return -EBADF; | 1905 | return -EBADF; |
| 1904 | } | 1906 | } |
| 1905 | 1907 | ||
