From: Alex Snast <asnast@gmail.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
linux-kernel@vger.kernel.org, Alex Snast <asnast@gmail.com>
Subject: [PATCH 2/2] perf tools: Use rb_entry_safe on first / next symbol lookup
Date: Sat, 19 Sep 2015 16:03:35 +0300 [thread overview]
Message-ID: <1442667815-10749-2-git-send-email-asnast@gmail.com> (raw)
In-Reply-To: <1442667815-10749-1-git-send-email-asnast@gmail.com>
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
next prev parent reply other threads:[~2015-09-19 13:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-19 13:03 [PATCH 1/2] perf tools: Use postorder rbtree iteration when removing symbols Alex Snast
2015-09-19 13:03 ` Alex Snast [this message]
2015-09-20 8:05 ` Ingo Molnar
[not found] ` <CAMqsXBcZAS6hCh8LdHjFGiji8dwHLQus1xf5OnK7CZEjrbx33w@mail.gmail.com>
2015-09-21 7:17 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1442667815-10749-2-git-send-email-asnast@gmail.com \
--to=asnast@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome