From: Nicolas Dichtel Date: Wed, 10 Dec 2014 23:45:07 +0000 (-0800) Subject: fs/proc.c: use rb_entry_safe() instead of rb_entry() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2fc1e948e820bddf8a686c6e2989219b471d7982;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git fs/proc.c: use rb_entry_safe() instead of rb_entry() Better to use existing macro that rewriting them. Signed-off-by: Nicolas Dichtel Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/proc/generic.c b/fs/proc/generic.c index be39c6feb3e5..7fea13229f33 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c @@ -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,