diff options
author | Rasmus Villemoes <[email protected]> | 2015-04-15 16:14:32 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2015-04-15 16:35:19 -0700 |
commit | 9fcd145717e6496d0c376acb1a5cc551a716c305 (patch) | |
tree | 88de36f6e45a2ddf1451e849b21f40259156d33a | |
parent | 215ba78115f82ad5f8faedac98cc42e572733b8a (diff) |
mm/mmap.c: use while instead of if+goto
The creators of the C language gave us the while keyword. Let's use
that instead of synthesizing it from if+goto.
Made possible by 6597d783397a ("mm/mmap.c: replace find_vma_prepare()
with clearer find_vma_links()").
[[email protected]: fix 80-col overflows]
Signed-off-by: Rasmus Villemoes <[email protected]>
Cc: "Kirill A. Shutemov" <[email protected]>
Cc: Sasha Levin <[email protected]>
Cc: Cyrill Gorcunov <[email protected]>
Cc: Roman Gushchin <[email protected]>
Cc: Hugh Dickins <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r-- | mm/mmap.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/mm/mmap.c b/mm/mmap.c index e65cbe0d64fc..bb50cacc3ea5 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1551,11 +1551,10 @@ unsigned long mmap_region(struct file *file, unsigned long addr, /* Clear old maps */ error = -ENOMEM; -munmap_back: - if (find_vma_links(mm, addr, addr + len, &prev, &rb_link, &rb_parent)) { + while (find_vma_links(mm, addr, addr + len, &prev, &rb_link, + &rb_parent)) { if (do_munmap(mm, addr, len)) return -ENOMEM; - goto munmap_back; } /* @@ -1571,7 +1570,8 @@ munmap_back: /* * Can we just expand an old mapping? */ - vma = vma_merge(mm, prev, addr, addr + len, vm_flags, NULL, file, pgoff, NULL); + vma = vma_merge(mm, prev, addr, addr + len, vm_flags, NULL, file, pgoff, + NULL); if (vma) goto out; @@ -2739,11 +2739,10 @@ static unsigned long do_brk(unsigned long addr, unsigned long len) /* * Clear old maps. this also does some error checking for us */ - munmap_back: - if (find_vma_links(mm, addr, addr + len, &prev, &rb_link, &rb_parent)) { + while (find_vma_links(mm, addr, addr + len, &prev, &rb_link, + &rb_parent)) { if (do_munmap(mm, addr, len)) return -ENOMEM; - goto munmap_back; } /* Check against address space limits *after* clearing old maps... */ |