mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
perf callchain: Check return value of split_add_child()
Now create_child() and add_child() return errors so check and pass it to the caller. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/1455631723-17345-6-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
2d713b809d
commit
f2bb4c5af4
1 changed files with 9 additions and 3 deletions
|
@ -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.
|
* give a part of its callchain to the created child.
|
||||||
* Then create another child to host the given callchain of new branch
|
* Then create another child to host the given callchain of new branch
|
||||||
*/
|
*/
|
||||||
static void
|
static int
|
||||||
split_add_child(struct callchain_node *parent,
|
split_add_child(struct callchain_node *parent,
|
||||||
struct callchain_cursor *cursor,
|
struct callchain_cursor *cursor,
|
||||||
struct callchain_list *to_split,
|
struct callchain_list *to_split,
|
||||||
|
@ -520,6 +520,8 @@ split_add_child(struct callchain_node *parent,
|
||||||
|
|
||||||
/* split */
|
/* split */
|
||||||
new = create_child(parent, true);
|
new = create_child(parent, true);
|
||||||
|
if (new == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
/* split the callchain and move a part to the new child */
|
/* split the callchain and move a part to the new child */
|
||||||
old_tail = parent->val.prev;
|
old_tail = parent->val.prev;
|
||||||
|
@ -554,7 +556,7 @@ split_add_child(struct callchain_node *parent,
|
||||||
node = callchain_cursor_current(cursor);
|
node = callchain_cursor_current(cursor);
|
||||||
new = add_child(parent, cursor, period);
|
new = add_child(parent, cursor, period);
|
||||||
if (new == NULL)
|
if (new == NULL)
|
||||||
return;
|
return -1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is second child since we moved parent's children
|
* 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->hit = period;
|
||||||
parent->count = 1;
|
parent->count = 1;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum match_result
|
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 */
|
/* we match only a part of the node. Split it and add the new chain */
|
||||||
if (matches < root->val_nr) {
|
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;
|
return MATCH_EQ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue