Skip to content

Commit

Permalink
fs/proc.c: use rb_entry_safe() instead of rb_entry()
Browse files Browse the repository at this point in the history
Better to use existing macro that rewriting them.

Signed-off-by: Nicolas Dichtel <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
NicolasDichtel authored and torvalds committed Dec 11, 2014
1 parent b208d54 commit 2fc1e94
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions fs/proc/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2fc1e94

Please sign in to comment.