diff options
| author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-04-02 09:04:18 -0400 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-04-02 15:28:31 -0400 |
| commit | ad5b217b152d99ca3922153500c619d9758dd87a (patch) | |
| tree | e0377f6f1de3394d29babe49c24a0152df18000d | |
| parent | b9fb93047756c5e4129dfda7591612de61b0e877 (diff) | |
perf session: Remove one more exit() call from library code
Return NULL instead and make the caller propagate the error.
LKML-Reference: <new-submission>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
| -rw-r--r-- | tools/perf/builtin-report.c | 5 | ||||
| -rw-r--r-- | tools/perf/util/session.c | 11 |
2 files changed, 7 insertions, 9 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 1fb13e5fd1f9..6767f10615ea 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
| @@ -89,9 +89,12 @@ static int perf_session__add_hist_entry(struct perf_session *self, | |||
| 89 | struct event_stat_id *stats; | 89 | struct event_stat_id *stats; |
| 90 | struct perf_event_attr *attr; | 90 | struct perf_event_attr *attr; |
| 91 | 91 | ||
| 92 | if ((sort__has_parent || symbol_conf.use_callchain) && data->callchain) | 92 | if ((sort__has_parent || symbol_conf.use_callchain) && data->callchain) { |
| 93 | syms = perf_session__resolve_callchain(self, al->thread, | 93 | syms = perf_session__resolve_callchain(self, al->thread, |
| 94 | data->callchain, &parent); | 94 | data->callchain, &parent); |
| 95 | if (syms == NULL) | ||
| 96 | return -ENOMEM; | ||
| 97 | } | ||
| 95 | 98 | ||
| 96 | attr = perf_header__find_attr(data->id, &self->header); | 99 | attr = perf_header__find_attr(data->id, &self->header); |
| 97 | if (attr) | 100 | if (attr) |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 9da5e723495c..ddf288fca3eb 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
| @@ -118,16 +118,11 @@ struct map_symbol *perf_session__resolve_callchain(struct perf_session *self, | |||
| 118 | struct symbol **parent) | 118 | struct symbol **parent) |
| 119 | { | 119 | { |
| 120 | u8 cpumode = PERF_RECORD_MISC_USER; | 120 | u8 cpumode = PERF_RECORD_MISC_USER; |
| 121 | struct map_symbol *syms = NULL; | ||
| 122 | unsigned int i; | 121 | unsigned int i; |
| 122 | struct map_symbol *syms = calloc(chain->nr, sizeof(*syms)); | ||
| 123 | 123 | ||
| 124 | if (symbol_conf.use_callchain) { | 124 | if (!syms) |
| 125 | syms = calloc(chain->nr, sizeof(*syms)); | 125 | return NULL; |
| 126 | if (!syms) { | ||
| 127 | fprintf(stderr, "Can't allocate memory for symbols\n"); | ||
| 128 | exit(-1); | ||
| 129 | } | ||
| 130 | } | ||
| 131 | 126 | ||
| 132 | for (i = 0; i < chain->nr; i++) { | 127 | for (i = 0; i < chain->nr; i++) { |
| 133 | u64 ip = chain->ips[i]; | 128 | u64 ip = chain->ips[i]; |
