diff options
author | Rasmus Villemoes <linux@rasmusvillemoes.dk> | 2015-04-15 19:14:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-15 19:35:19 -0400 |
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()").
[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>
-rw-r--r-- | mm/mmap.c | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -1551,11 +1551,10 @@ unsigned long mmap_region(struct file *file, unsigned long addr, | |||
1551 | 1551 | ||
1552 | /* Clear old maps */ | 1552 | /* Clear old maps */ |
1553 | error = -ENOMEM; | 1553 | error = -ENOMEM; |
1554 | munmap_back: | 1554 | while (find_vma_links(mm, addr, addr + len, &prev, &rb_link, |
1555 | if (find_vma_links(mm, addr, addr + len, &prev, &rb_link, &rb_parent)) { | 1555 | &rb_parent)) { |
1556 | if (do_munmap(mm, addr, len)) | 1556 | if (do_munmap(mm, addr, len)) |
1557 | return -ENOMEM; | 1557 | return -ENOMEM; |
1558 | goto munmap_back; | ||
1559 | } | 1558 | } |
1560 | 1559 | ||
1561 | /* | 1560 | /* |
@@ -1571,7 +1570,8 @@ munmap_back: | |||
1571 | /* | 1570 | /* |
1572 | * Can we just expand an old mapping? | 1571 | * Can we just expand an old mapping? |
1573 | */ | 1572 | */ |
1574 | vma = vma_merge(mm, prev, addr, addr + len, vm_flags, NULL, file, pgoff, NULL); | 1573 | vma = vma_merge(mm, prev, addr, addr + len, vm_flags, NULL, file, pgoff, |
1574 | NULL); | ||
1575 | if (vma) | 1575 | if (vma) |
1576 | goto out; | 1576 | goto out; |
1577 | 1577 | ||
@@ -2739,11 +2739,10 @@ static unsigned long do_brk(unsigned long addr, unsigned long len) | |||
2739 | /* | 2739 | /* |
2740 | * Clear old maps. this also does some error checking for us | 2740 | * Clear old maps. this also does some error checking for us |
2741 | */ | 2741 | */ |
2742 | munmap_back: | 2742 | while (find_vma_links(mm, addr, addr + len, &prev, &rb_link, |
2743 | if (find_vma_links(mm, addr, addr + len, &prev, &rb_link, &rb_parent)) { | 2743 | &rb_parent)) { |
2744 | if (do_munmap(mm, addr, len)) | 2744 | if (do_munmap(mm, addr, len)) |
2745 | return -ENOMEM; | 2745 | return -ENOMEM; |
2746 | goto munmap_back; | ||
2747 | } | 2746 | } |
2748 | 2747 | ||
2749 | /* Check against address space limits *after* clearing old maps... */ | 2748 | /* Check against address space limits *after* clearing old maps... */ |