Commit 2542e5134d2c19a9e6a4e641ef78cac6bccebd9b

Authored by Cesar Eduardo Barros
Committed by Linus Torvalds
1 parent 53cbb2435f

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 <cesarb@cesarb.net>
Tested-by: Eric B Munson <emunson@mgebm.net>
Acked-by: Eric B Munson <emunson@mgebm.net>
Reviewed-by: Pekka Enberg <penberg@kernel.org>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 2 additions and 4 deletions Side-by-side Diff

... ... @@ -1918,10 +1918,8 @@
1918 1918 return -EPERM;
1919 1919  
1920 1920 p = alloc_swap_info();
1921   - if (IS_ERR(p)) {
1922   - error = PTR_ERR(p);
1923   - goto out;
1924   - }
  1921 + if (IS_ERR(p))
  1922 + return PTR_ERR(p);
1925 1923  
1926 1924 name = getname(specialfile);
1927 1925 error = PTR_ERR(name);