Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1324159
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 04/21] perf callchain: Check return value of split_add_child() |
| Date | 2016-02-02 15:50 +0100 |
| Message-ID | <qXKrh-4kd-51@gated-at.bofh.it> (permalink) |
| References | <qXKrf-4kd-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Now create_child() and add_child() return errors so check and pass it
to the caller.
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/callchain.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index dab2c1f1e86b..5259379892e1 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -508,7 +508,7 @@ static enum match_result match_chain(struct callchain_cursor_node *node,
* give a part of its callchain to the created child.
* Then create another child to host the given callchain of new branch
*/
-static void
+static int
split_add_child(struct callchain_node *parent,
struct callchain_cursor *cursor,
struct callchain_list *to_split,
@@ -520,6 +520,8 @@ split_add_child(struct callchain_node *parent,
/* split */
new = create_child(parent, true);
+ if (new == NULL)
+ return -1;
/* split the callchain and move a part to the new child */
old_tail = parent->val.prev;
@@ -554,7 +556,7 @@ split_add_child(struct callchain_node *parent,
node = callchain_cursor_current(cursor);
new = add_child(parent, cursor, period);
if (new == NULL)
- return;
+ return -1;
/*
* This is second child since we moved parent's children
@@ -576,6 +578,7 @@ split_add_child(struct callchain_node *parent,
parent->hit = period;
parent->count = 1;
}
+ return 0;
}
static enum match_result
@@ -670,7 +673,10 @@ append_chain(struct callchain_node *root,
/* we match only a part of the node. Split it and add the new chain */
if (matches < root->val_nr) {
- split_add_child(root, cursor, cnode, start, matches, period);
+ if (split_add_child(root, cursor, cnode, start, matches,
+ period) < 0)
+ return MATCH_ERROR;
+
return MATCH_EQ;
}
--
2.6.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCHSET 00/21] perf tools: Add support for hierachy view (v4) Namhyung Kim <namhyung@kernel.org> - 2016-02-02 15:50 +0100 [PATCH 04/21] perf callchain: Check return value of split_add_child() Namhyung Kim <namhyung@kernel.org> - 2016-02-02 15:50 +0100 [PATCH 10/21] perf hists: Add helper functions for hierarchy mode Namhyung Kim <namhyung@kernel.org> - 2016-02-02 15:50 +0100 [PATCH 15/21] perf hists browser: Support collapsing/expanding whole entries in hierarchy Namhyung Kim <namhyung@kernel.org> - 2016-02-02 15:50 +0100 [PATCH 09/21] perf hists: Resort hist entries with hierarchy Namhyung Kim <namhyung@kernel.org> - 2016-02-02 15:50 +0100 [PATCH 12/21] perf ui/stdio: Implement hierarchy output mode Namhyung Kim <namhyung@kernel.org> - 2016-02-02 15:50 +0100 [PATCH 05/21] perf callchain: Check return value of append_chain_children() Namhyung Kim <namhyung@kernel.org> - 2016-02-02 15:50 +0100 [PATCH 18/21] perf ui/gtk: Implement hierarchy output mode Namhyung Kim <namhyung@kernel.org> - 2016-02-02 15:50 +0100 [PATCH 17/21] perf hists browser: Align column header in hierarchy mode Namhyung Kim <namhyung@kernel.org> - 2016-02-02 15:50 +0100 [PATCH 21/21] perf top: Add --hierarchy option Namhyung Kim <namhyung@kernel.org> - 2016-02-02 15:50 +0100 [PATCH 02/21] perf callchain: Check return value of fill_node() Namhyung Kim <namhyung@kernel.org> - 2016-02-02 15:50 +0100
csiph-web