summaryrefslogtreecommitdiffstats
path: root/mm/mlock.c
diff options
context:
space:
mode:
authorAlexey Klimov <klimov.linux@gmail.com>2015-11-05 18:46:00 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-05 19:34:48 -0800
commit86d2adccfbe7d5a1f050fa08db9638c9168736d9 (patch)
tree96dcb3362de8603a9e8be77498eb3edc57d46d1d /mm/mlock.c
parent9fbed25407ccc87a7bb47ea3f411e1ca34a95f8b (diff)
downloadlinux-stable-86d2adccfbe7d5a1f050fa08db9638c9168736d9.tar.gz
linux-stable-86d2adccfbe7d5a1f050fa08db9638c9168736d9.tar.bz2
linux-stable-86d2adccfbe7d5a1f050fa08db9638c9168736d9.zip
mm/mlock.c: reorganize mlockall() return values and remove goto-out label
In mlockall syscall wrapper after out-label for goto code just doing return. Remove goto out statements and return error values directly. Also instead of rewriting ret variable before every if-check move returns to 'error'-like path under if-check. Objdump asm listing showed me reducing by few asm lines. Object file size descreased from 220592 bytes to 220528 bytes for me (for aarch64). Signed-off-by: Alexey Klimov <klimov.linux@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/mlock.c')
-rw-r--r--mm/mlock.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/mm/mlock.c b/mm/mlock.c
index 25936680064f..7e6ad9c4c549 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -684,14 +684,13 @@ out:
SYSCALL_DEFINE1(mlockall, int, flags)
{
unsigned long lock_limit;
- int ret = -EINVAL;
+ int ret;
if (!flags || (flags & ~(MCL_CURRENT | MCL_FUTURE)))
- goto out;
+ return -EINVAL;
- ret = -EPERM;
if (!can_do_mlock())
- goto out;
+ return -EPERM;
if (flags & MCL_CURRENT)
lru_add_drain_all(); /* flush pagevec */
@@ -708,7 +707,7 @@ SYSCALL_DEFINE1(mlockall, int, flags)
up_write(&current->mm->mmap_sem);
if (!ret && (flags & MCL_CURRENT))
mm_populate(0, TASK_SIZE);
-out:
+
return ret;
}