* [PATCH] proc: simpler /proc/vmcore cleanup
@ 2017-11-21 19:11 Alexey Dobriyan
0 siblings, 0 replies; only message in thread
From: Alexey Dobriyan @ 2017-11-21 19:11 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, mahesh
Iterators aren't necessary as you can just grab the first entry and
delete it until no entries left.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
fs/proc/vmcore.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
--- a/fs/proc/vmcore.c
+++ b/fs/proc/vmcore.c
@@ -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);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-11-21 19:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-21 19:11 [PATCH] proc: simpler /proc/vmcore cleanup Alexey Dobriyan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.