From: Miaohe Lin Date: Thu, 19 May 2022 21:08:51 +0000 (-0700) Subject: mm/swap: remove unneeded p != NULL check in __swap_duplicate X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=dab8dfff49a673a4b070ad3f44534b3c0e88a189;p=linux.git mm/swap: remove unneeded p != NULL check in __swap_duplicate If p is NULL, __swap_duplicate will already return -EINVAL. So if we reach here, p must be non-NULL. Link: https://lkml.kernel.org/r/20220509131416.17553-8-linmiaohe@huawei.com Signed-off-by: Miaohe Lin Reviewed-by: David Hildenbrand Reviewed-by: Oscar Salvador Cc: Alistair Popple Cc: David Howells Cc: Matthew Wilcox Cc: Naoya Horiguchi Cc: NeilBrown Cc: Peter Xu Cc: Suren Baghdasaryan Cc: Vlastimil Babka Signed-off-by: Andrew Morton --- diff --git a/mm/swapfile.c b/mm/swapfile.c index f59abca5cea97..e67addac61e20 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -3333,8 +3333,7 @@ static int __swap_duplicate(swp_entry_t entry, unsigned char usage) unlock_out: unlock_cluster_or_swap_info(p, ci); - if (p) - put_swap_device(p); + put_swap_device(p); return err; }