[PATCH 09/12] mm/swapfile.c: remove the unneeded checking

From: Baoquan He
Date: Wed Feb 05 2025 - 04:29:46 EST


In free_swap_and_cache_nr(), invocation of get_swap_device() has done
the checking if it's a swap entry. So remove the redundant checking
here.

Signed-off-by: Baoquan He <bhe@xxxxxxxxxx>
---
mm/swapfile.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/mm/swapfile.c b/mm/swapfile.c
index 78b7329ad2c7..2a25ff5f31c8 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1784,9 +1784,6 @@ void free_swap_and_cache_nr(swp_entry_t entry, int nr)
bool any_only_cache = false;
unsigned long offset;

- if (non_swap_entry(entry))
- return;
-
si = get_swap_device(entry);
if (!si)
return;
--
2.41.0