diff mbox series

[1/4] mm/sparse: nr_pages won't be 0

Message ID 20240619010612.20740-1-richard.weiyang@gmail.com (mailing list archive)
State New
Headers show
Series [1/4] mm/sparse: nr_pages won't be 0 | expand

Commit Message

Wei Yang June 19, 2024, 1:06 a.m. UTC
Function subsection_map_init() is only used in free_area_init() in the
loop of for_each_mem_pfn_range(). And we are sure in each iteration of
for_each_mem_pfn_range(), start_pfn < end_pfn.

So nr_pages is not possible to be 0 and we can remove the check.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: Mike Rapoport (IBM) <rppt@kernel.org>
---
 mm/sparse.c | 3 ---
 1 file changed, 3 deletions(-)
diff mbox series

Patch

diff --git a/mm/sparse.c b/mm/sparse.c
index de40b2c73406..f56701873ce8 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -195,9 +195,6 @@  void __init subsection_map_init(unsigned long pfn, unsigned long nr_pages)
 	int end_sec = pfn_to_section_nr(pfn + nr_pages - 1);
 	unsigned long nr, start_sec = pfn_to_section_nr(pfn);
 
-	if (!nr_pages)
-		return;
-
 	for (nr = start_sec; nr <= end_sec; nr++) {
 		struct mem_section *ms;
 		unsigned long pfns;