Commit e376ed7c authored by Cody P Schafer's avatar Cody P Schafer Committed by Linus Torvalds

arch/sh/kernel/dwarf.c: use rbtree postorder iteration helper instead of...

arch/sh/kernel/dwarf.c: use rbtree postorder iteration helper instead of solution using repeated rb_erase()

Use rbtree_postorder_for_each_entry_safe() to destroy the rbtree instead
of using repeated rb_erase() calls
Signed-off-by: default avatarCody P Schafer <cody@linux.vnet.ibm.com>
Cc: Michel Lespinasse <walken@google.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ed8f6866
...@@ -995,29 +995,19 @@ static struct unwinder dwarf_unwinder = { ...@@ -995,29 +995,19 @@ static struct unwinder dwarf_unwinder = {
static void dwarf_unwinder_cleanup(void) static void dwarf_unwinder_cleanup(void)
{ {
struct rb_node **fde_rb_node = &fde_root.rb_node; struct dwarf_fde *fde, *next_fde;
struct rb_node **cie_rb_node = &cie_root.rb_node; struct dwarf_cie *cie, *next_cie;
/* /*
* Deallocate all the memory allocated for the DWARF unwinder. * Deallocate all the memory allocated for the DWARF unwinder.
* Traverse all the FDE/CIE lists and remove and free all the * Traverse all the FDE/CIE lists and remove and free all the
* memory associated with those data structures. * memory associated with those data structures.
*/ */
while (*fde_rb_node) { rbtree_postorder_for_each_entry_safe(fde, next_fde, &fde_root, node)
struct dwarf_fde *fde;
fde = rb_entry(*fde_rb_node, struct dwarf_fde, node);
rb_erase(*fde_rb_node, &fde_root);
kfree(fde); kfree(fde);
}
while (*cie_rb_node) { rbtree_postorder_for_each_entry_safe(cie, next_cie, &cie_root, node)
struct dwarf_cie *cie;
cie = rb_entry(*cie_rb_node, struct dwarf_cie, node);
rb_erase(*cie_rb_node, &cie_root);
kfree(cie); kfree(cie);
}
kmem_cache_destroy(dwarf_reg_cachep); kmem_cache_destroy(dwarf_reg_cachep);
kmem_cache_destroy(dwarf_frame_cachep); kmem_cache_destroy(dwarf_frame_cachep);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment