When si->cluster_nr is zero, function would reach done and return. The increased offset would not be used any more. This means we can move the offset increment into the if clause. This brings a further code cleanup possibility. Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx> --- mm/swapfile.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 6b6e41967bf3..52afb74fc3d1 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -871,11 +871,9 @@ static int scan_swap_map_slots(struct swap_info_struct *si, else goto done; } - /* non-ssd case */ - ++offset; /* non-ssd case, still more slots in cluster? */ - if (si->cluster_nr && !si->swap_map[offset]) { + if (si->cluster_nr && !si->swap_map[++offset]) { --si->cluster_nr; goto checks; } -- 2.23.0