fs/proc.c: use rb_entry_safe() instead of rb_entry()
authorNicolas Dichtel <nicolas.dichtel@6wind.com>
Wed, 10 Dec 2014 23:45:07 +0000 (15:45 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 11 Dec 2014 01:41:09 +0000 (17:41 -0800)
Better to use existing macro that rewriting them.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/proc/generic.c

index be39c6feb3e56c5f12bd1afab9c7b1867959b77c..7fea13229f3370b7a926feebc3547cd7c2c9184b 100644 (file)
@@ -41,22 +41,14 @@ static int proc_match(unsigned int len, const char *name, struct proc_dir_entry
 
 static struct proc_dir_entry *pde_subdir_first(struct proc_dir_entry *dir)
 {
-       struct rb_node *node = rb_first(&dir->subdir);
-
-       if (node == NULL)
-               return NULL;
-
-       return rb_entry(node, struct proc_dir_entry, subdir_node);
+       return rb_entry_safe(rb_first(&dir->subdir), struct proc_dir_entry,
+                            subdir_node);
 }
 
 static struct proc_dir_entry *pde_subdir_next(struct proc_dir_entry *dir)
 {
-       struct rb_node *node = rb_next(&dir->subdir_node);
-
-       if (node == NULL)
-               return NULL;
-
-       return rb_entry(node, struct proc_dir_entry, subdir_node);
+       return rb_entry_safe(rb_next(&dir->subdir_node), struct proc_dir_entry,
+                            subdir_node);
 }
 
 static struct proc_dir_entry *pde_subdir_find(struct proc_dir_entry *dir,
This page took 0.029212 seconds and 5 git commands to generate.