linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geliang Tang <geliangtang@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	John Stultz <john.stultz@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: Geliang Tang <geliangtang@gmail.com>, linux-kernel@vger.kernel.org
Subject: [PATCH] timerqueue: use rb_entry_safe
Date: Tue, 20 Dec 2016 21:57:44 +0800	[thread overview]
Message-ID: <0d5cf199ac43792df0b6f7e2145545c30fa1dbbe.1482222135.git.geliangtang@gmail.com> (raw)
In-Reply-To: <1e433cd03b01a3e89a22de5aa160b3442ff0cf16.1482222608.git.geliangtang@gmail.com>

Use rb_entry_safe() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 lib/timerqueue.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/timerqueue.c b/lib/timerqueue.c
index 782ae8c..3debca0 100644
--- a/lib/timerqueue.c
+++ b/lib/timerqueue.c
@@ -80,8 +80,7 @@ bool timerqueue_del(struct timerqueue_head *head, struct timerqueue_node *node)
 	if (head->next == node) {
 		struct rb_node *rbn = rb_next(&node->node);
 
-		head->next = rbn ?
-			rb_entry(rbn, struct timerqueue_node, node) : NULL;
+		head->next = rb_entry_safe(rbn, struct timerqueue_node, node);
 	}
 	rb_erase(&node->node, &head->head);
 	RB_CLEAR_NODE(&node->node);
-- 
2.9.3

  parent reply	other threads:[~2016-12-20 13:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-20 13:57 [PATCH] f2fs: use rb_entry_safe Geliang Tang
2016-12-20 13:57 ` [PATCH] mm/vmalloc.c: " Geliang Tang
2016-12-20 14:35   ` Michal Hocko
2016-12-20 13:57 ` Geliang Tang [this message]
2017-01-20  7:06   ` [tip:timers/core] timerqueue: Use rb_entry_safe() instead of open-coding it tip-bot for Geliang Tang

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=0d5cf199ac43792df0b6f7e2145545c30fa1dbbe.1482222135.git.geliangtang@gmail.com \
    --to=geliangtang@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).