]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm/mmap.c: use while instead of if+goto
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Tue, 7 Apr 2015 23:44:33 +0000 (09:44 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 7 Apr 2015 23:44:33 +0000 (09:44 +1000)
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()").

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>
mm/mmap.c

index e65cbe0d64fcadc20adce3945b5a0db29f478791..508ef01128a70b15834838c148c4eb088df507d2 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1551,11 +1551,9 @@ 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;
        }
 
        /*
@@ -2739,11 +2737,9 @@ 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... */