timerqueue: Use rb_entry_safe() instead of open-coding it
authorGeliang Tang <geliangtang@gmail.com>
Tue, 20 Dec 2016 13:57:44 +0000 (21:57 +0800)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 20 Jan 2017 07:03:42 +0000 (08:03 +0100)
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: John Stultz <john.stultz@linaro.org>
Link: http://lkml.kernel.org/r/0d5cf199ac43792df0b6f7e2145545c30fa1dbbe.1482222135.git.geliangtang@gmail.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
lib/timerqueue.c

index adc6ee0a51267ab6691c6244cddbd5da69c059f9..4a720ed4fdafd575df46159a3d51131902d638e4 100644 (file)
@@ -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);