Skip to content

Commit

Permalink
fs/proc/vmcore.c: simpler /proc/vmcore cleanup
Browse files Browse the repository at this point in the history
Iterators aren't necessary as you can just grab the first entry and delete
it until no entries left.

Link: http://lkml.kernel.org/r/20171121191121.GA20757@avx2
Signed-off-by: Alexey Dobriyan <[email protected]>
Cc: Mahesh Salgaonkar <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Alexey Dobriyan authored and torvalds committed Feb 7, 2018
1 parent ac7f106 commit 593bc69
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions fs/proc/vmcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -1178,18 +1178,16 @@ fs_initcall(vmcore_init);
/* Cleanup function for vmcore module. */
void vmcore_cleanup(void)
{
struct list_head *pos, *next;

if (proc_vmcore) {
proc_remove(proc_vmcore);
proc_vmcore = NULL;
}

/* clear the vmcore list. */
list_for_each_safe(pos, next, &vmcore_list) {
while (!list_empty(&vmcore_list)) {
struct vmcore *m;

m = list_entry(pos, struct vmcore, list);
m = list_first_entry(&vmcore_list, struct vmcore, list);
list_del(&m->list);
kfree(m);
}
Expand Down

0 comments on commit 593bc69

Please sign in to comment.