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 6597d78339 ("mm/mmap.c: replace find_vma_prepare()
with clearer find_vma_links()").

[akpm@linux-foundation.org: fix 80-col overflows]
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Roman Gushchin <klamm@yandex-team.ru>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Rasmus Villemoes 2015-04-15 16:14:32 -07:00 committed by Linus Torvalds
parent 215ba78115
commit 9fcd145717
1 changed files with 6 additions and 7 deletions

View File

@ -1551,11 +1551,10 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
/* Clear old maps */ /* Clear old maps */
error = -ENOMEM; error = -ENOMEM;
munmap_back: while (find_vma_links(mm, addr, addr + len, &prev, &rb_link,
if (find_vma_links(mm, addr, addr + len, &prev, &rb_link, &rb_parent)) { &rb_parent)) {
if (do_munmap(mm, addr, len)) if (do_munmap(mm, addr, len))
return -ENOMEM; return -ENOMEM;
goto munmap_back;
} }
/* /*
@ -1571,7 +1570,8 @@ munmap_back:
/* /*
* Can we just expand an old mapping? * 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) if (vma)
goto out; 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 * Clear old maps. this also does some error checking for us
*/ */
munmap_back: while (find_vma_links(mm, addr, addr + len, &prev, &rb_link,
if (find_vma_links(mm, addr, addr + len, &prev, &rb_link, &rb_parent)) { &rb_parent)) {
if (do_munmap(mm, addr, len)) if (do_munmap(mm, addr, len))
return -ENOMEM; return -ENOMEM;
goto munmap_back;
} }
/* Check against address space limits *after* clearing old maps... */ /* Check against address space limits *after* clearing old maps... */