Messages in this thread Patch in this message | | | From | Alex Snast <> | Subject | [PATCH 2/2] perf tools: Use rb_entry_safe on first / next symbol lookup | Date | Sat, 19 Sep 2015 16:03:35 +0300 |
| |
Signed-off-by: Alex Snast <asnast@gmail.com> --- tools/perf/util/symbol.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 8b3608c..5728121 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -344,20 +344,14 @@ static struct symbol *symbols__first(struct rb_root *symbols) { struct rb_node *n = rb_first(symbols); - if (n) - return rb_entry(n, struct symbol, rb_node); - - return NULL; + return rb_entry_safe(n, struct symbol, rb_node); } static struct symbol *symbols__next(struct symbol *sym) { struct rb_node *n = rb_next(&sym->rb_node); - if (n) - return rb_entry(n, struct symbol, rb_node); - - return NULL; + return rb_entry_safe(n, struct symbol, rb_node); } struct symbol_name_rb_node { -- 2.1.4
| |