From: Cesar Eduardo Barros Date: Tue, 22 Mar 2011 23:33:18 +0000 (-0700) Subject: sys_swapon: simplify error return from swap_info allocation X-Git-Tag: v2.6.39-rc1~309 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=2542e5134d2c19a9e6a4e641ef78cac6bccebd9b;p=~emulex%2Finfiniband.git sys_swapon: simplify error return from swap_info allocation At this point in sys_swapon, there is nothing to free. Return directly instead of jumping to the cleanup block at the end of the function. Signed-off-by: Cesar Eduardo Barros Tested-by: Eric B Munson Acked-by: Eric B Munson Reviewed-by: Pekka Enberg Reviewed-by: KAMEZAWA Hiroyuki Cc: Hugh Dickins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/swapfile.c b/mm/swapfile.c index 6d1c3c67ae6..4d457d699c1 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1918,10 +1918,8 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) return -EPERM; p = alloc_swap_info(); - if (IS_ERR(p)) { - error = PTR_ERR(p); - goto out; - } + if (IS_ERR(p)) + return PTR_ERR(p); name = getname(specialfile); error = PTR_ERR(name);