summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorMiaohe Lin <linmiaohe@huawei.com>2020-12-14 19:06:04 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2020-12-15 12:13:39 -0800
commit9d9a03340309cb8065503cfa3c5c5fc8b7670230 (patch)
tree87f4fc34b9e59b796372b2559b64e60d79d2c7b3 /mm
parente97af69950ffe8be4ee12b331924b8de8a17b73e (diff)
mm/swapfile.c: remove unnecessary out label in __swap_duplicate()
When the code went to the out label, it must have p == NULL. So what out label really does is redundant if check and return err. We should Remove this unnecessary out label because it does not handle resource free and so on. Link: https://lkml.kernel.org/r/20201009130337.29698-1-linmiaohe@huawei.com Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/swapfile.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 4a6ff685a736..83df467e1135 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -3445,11 +3445,11 @@ static int __swap_duplicate(swp_entry_t entry, unsigned char usage)
unsigned long offset;
unsigned char count;
unsigned char has_cache;
- int err = -EINVAL;
+ int err;
p = get_swap_device(entry);
if (!p)
- goto out;
+ return -EINVAL;
offset = swp_offset(entry);
ci = lock_cluster_or_swap_info(p, offset);
@@ -3496,7 +3496,6 @@ static int __swap_duplicate(swp_entry_t entry, unsigned char usage)
unlock_out:
unlock_cluster_or_swap_info(p, ci);
-out:
if (p)
put_swap_device(p);
return err;