]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
staging: lustre: osc: use rb_entry_safe
authorGeliang Tang <geliangtang@gmail.com>
Tue, 20 Dec 2016 13:56:55 +0000 (21:56 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 3 Jan 2017 14:14:23 +0000 (15:14 +0100)
Use rb_entry_safe() instead of container_of() to simplify the code.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/osc/osc_cache.c

index a7f57f5763fc2d0ba4d429e38ff6ca28af8b6782..5ac0e1439c2bd6e2ba78859b909290d0836879c2 100644 (file)
@@ -142,10 +142,7 @@ static const char *oes_strings[] = {
 
 static inline struct osc_extent *rb_extent(struct rb_node *n)
 {
-       if (!n)
-               return NULL;
-
-       return container_of(n, struct osc_extent, oe_node);
+       return rb_entry_safe(n, struct osc_extent, oe_node);
 }
 
 static inline struct osc_extent *next_extent(struct osc_extent *ext)