From: Nicolas Dichtel Subject: [PATCH linux-next] fs/proc: use rb_entry_safe() instead of rb_entry() Date: Fri, 24 Oct 2014 14:05:46 +0200 Message-ID: <1414152346-13635-1-git-send-email-nicolas.dichtel@6wind.com> Cc: linux-fsdevel@vger.kernel.org, Nicolas Dichtel To: akpm@linux-foundation.org Return-path: Received: from 33.106-14-84.ripe.coltfrance.com ([84.14.106.33]:47361 "EHLO proxy.6wind.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756090AbaJXMLx (ORCPT ); Fri, 24 Oct 2014 08:11:53 -0400 Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Better to use existing macro that rewriting them. Signed-off-by: Nicolas Dichtel --- fs/proc/generic.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 9f8fa1e5e8aa..371ae5ceab0d 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, -- 2.1.0