mm/vmalloc.c: use rb_entry_safe
authorGeliang Tang <geliangtang@gmail.com>
Wed, 22 Feb 2017 23:41:54 +0000 (15:41 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 23 Feb 2017 00:41:27 +0000 (16:41 -0800)
Use rb_entry_safe() instead of open-coding it.

Link: http://lkml.kernel.org/r/81bb9820e5b9e4a1c596b3e76f88abf8c4a76cb0.1482221947.git.geliangtang@gmail.com
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/vmalloc.c

index 3ca82d44edd344a2800b8029f5d6e1d27d8d528b..5f5b09e9dccdffa8445b25e6772fc0905492b0f5 100644 (file)
@@ -2309,7 +2309,7 @@ EXPORT_SYMBOL_GPL(free_vm_area);
 #ifdef CONFIG_SMP
 static struct vmap_area *node_to_va(struct rb_node *n)
 {
-       return n ? rb_entry(n, struct vmap_area, rb_node) : NULL;
+       return rb_entry_safe(n, struct vmap_area, rb_node);
 }
 
 /**