Merge tag 'vmwgfx-fixes-3.14-2014-02-05' of git://people.freedesktop.org/~thomash...
[firefly-linux-kernel-4.4.55.git] / fs / jffs2 / readinode.c
index ae81b01e6fd7ebe8291cfcba8b419b245a6a2310..386303dca382e636fa9aab5d547f343e2e5058a1 100644 (file)
@@ -543,33 +543,13 @@ static int jffs2_build_inode_fragtree(struct jffs2_sb_info *c,
 
 static void jffs2_free_tmp_dnode_info_list(struct rb_root *list)
 {
-       struct rb_node *this;
-       struct jffs2_tmp_dnode_info *tn;
-
-       this = list->rb_node;
+       struct jffs2_tmp_dnode_info *tn, *next;
 
-       /* Now at bottom of tree */
-       while (this) {
-               if (this->rb_left)
-                       this = this->rb_left;
-               else if (this->rb_right)
-                       this = this->rb_right;
-               else {
-                       tn = rb_entry(this, struct jffs2_tmp_dnode_info, rb);
+       rbtree_postorder_for_each_entry_safe(tn, next, list, rb) {
                        jffs2_free_full_dnode(tn->fn);
                        jffs2_free_tmp_dnode_info(tn);
-
-                       this = rb_parent(this);
-                       if (!this)
-                               break;
-
-                       if (this->rb_left == &tn->rb)
-                               this->rb_left = NULL;
-                       else if (this->rb_right == &tn->rb)
-                               this->rb_right = NULL;
-                       else BUG();
-               }
        }
+
        *list = RB_ROOT;
 }