diff options
author | Nicolas Dichtel <nicolas.dichtel@6wind.com> | 2014-12-10 18:45:07 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-10 20:41:09 -0500 |
commit | 2fc1e948e820bddf8a686c6e2989219b471d7982 (patch) | |
tree | f06ab547b8864f69d0c6d11a3d628c064a15d851 /fs/proc | |
parent | b208d54b75399b276b05f9e70cce8d3a59a42547 (diff) |
fs/proc.c: use rb_entry_safe() instead of rb_entry()
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>
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/generic.c | 16 |
1 files changed, 4 insertions, 12 deletions
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 | |||
41 | 41 | ||
42 | static struct proc_dir_entry *pde_subdir_first(struct proc_dir_entry *dir) | 42 | static struct proc_dir_entry *pde_subdir_first(struct proc_dir_entry *dir) |
43 | { | 43 | { |
44 | struct rb_node *node = rb_first(&dir->subdir); | 44 | return rb_entry_safe(rb_first(&dir->subdir), struct proc_dir_entry, |
45 | 45 | subdir_node); | |
46 | if (node == NULL) | ||
47 | return NULL; | ||
48 | |||
49 | return rb_entry(node, struct proc_dir_entry, subdir_node); | ||
50 | } | 46 | } |
51 | 47 | ||
52 | static struct proc_dir_entry *pde_subdir_next(struct proc_dir_entry *dir) | 48 | static struct proc_dir_entry *pde_subdir_next(struct proc_dir_entry *dir) |
53 | { | 49 | { |
54 | struct rb_node *node = rb_next(&dir->subdir_node); | 50 | return rb_entry_safe(rb_next(&dir->subdir_node), struct proc_dir_entry, |
55 | 51 | subdir_node); | |
56 | if (node == NULL) | ||
57 | return NULL; | ||
58 | |||
59 | return rb_entry(node, struct proc_dir_entry, subdir_node); | ||
60 | } | 52 | } |
61 | 53 | ||
62 | static struct proc_dir_entry *pde_subdir_find(struct proc_dir_entry *dir, | 54 | static struct proc_dir_entry *pde_subdir_find(struct proc_dir_entry *dir, |