drivers/base/memory.c: don't store end_section_nr in memory blocks
[linux-2.6-microblaze.git] / drivers / base / node.c
index 840c95b..257449c 100644 (file)
@@ -756,13 +756,13 @@ static int __ref get_nid_for_pfn(unsigned long pfn)
 static int register_mem_sect_under_node(struct memory_block *mem_blk,
                                         void *arg)
 {
+       unsigned long memory_block_pfns = memory_block_size_bytes() / PAGE_SIZE;
+       unsigned long start_pfn = section_nr_to_pfn(mem_blk->start_section_nr);
+       unsigned long end_pfn = start_pfn + memory_block_pfns - 1;
        int ret, nid = *(int *)arg;
-       unsigned long pfn, sect_start_pfn, sect_end_pfn;
+       unsigned long pfn;
 
-       sect_start_pfn = section_nr_to_pfn(mem_blk->start_section_nr);
-       sect_end_pfn = section_nr_to_pfn(mem_blk->end_section_nr);
-       sect_end_pfn += PAGES_PER_SECTION - 1;
-       for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) {
+       for (pfn = start_pfn; pfn <= end_pfn; pfn++) {
                int page_nid;
 
                /*