]> www.infradead.org Git - nvme.git/commitdiff
mm/sparse: nr_pages won't be 0
authorWei Yang <richard.weiyang@gmail.com>
Wed, 19 Jun 2024 01:06:09 +0000 (01:06 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 4 Jul 2024 02:30:19 +0000 (19:30 -0700)
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.

Link: https://lkml.kernel.org/r/20240619010612.20740-1-richard.weiyang@gmail.com
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Cc: Mike Rapoport (IBM) <rppt@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/sparse.c

index 8724a06d812884d037b0f0410abec64824584d6a..e4b830091d137387c1a18536e494a8f2db8f8c58 100644 (file)
@@ -195,9 +195,6 @@ void __init subsection_map_init(unsigned long pfn, unsigned long nr_pages)
        int end_sec_nr = pfn_to_section_nr(pfn + nr_pages - 1);
        unsigned long nr, start_sec_nr = pfn_to_section_nr(pfn);
 
-       if (!nr_pages)
-               return;
-
        for (nr = start_sec_nr; nr <= end_sec_nr; nr++) {
                struct mem_section *ms;
                unsigned long pfns;