提交 2fc1e948 编写于 作者: N Nicolas Dichtel 提交者: Linus Torvalds

fs/proc.c: use rb_entry_safe() instead of rb_entry()

Better to use existing macro that rewriting them.
Signed-off-by: NNicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 b208d54b
......@@ -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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册