aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/node.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/node.c')
-rw-r--r--drivers/base/node.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/base/node.c b/drivers/base/node.c
index 2872e86837b2..ee53558b452f 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -409,25 +409,27 @@ static int link_mem_sections(int nid)
409 unsigned long start_pfn = NODE_DATA(nid)->node_start_pfn; 409 unsigned long start_pfn = NODE_DATA(nid)->node_start_pfn;
410 unsigned long end_pfn = start_pfn + NODE_DATA(nid)->node_spanned_pages; 410 unsigned long end_pfn = start_pfn + NODE_DATA(nid)->node_spanned_pages;
411 unsigned long pfn; 411 unsigned long pfn;
412 struct memory_block *mem_blk = NULL;
412 int err = 0; 413 int err = 0;
413 414
414 for (pfn = start_pfn; pfn < end_pfn; pfn += PAGES_PER_SECTION) { 415 for (pfn = start_pfn; pfn < end_pfn; pfn += PAGES_PER_SECTION) {
415 unsigned long section_nr = pfn_to_section_nr(pfn); 416 unsigned long section_nr = pfn_to_section_nr(pfn);
416 struct mem_section *mem_sect; 417 struct mem_section *mem_sect;
417 struct memory_block *mem_blk;
418 int ret; 418 int ret;
419 419
420 if (!present_section_nr(section_nr)) 420 if (!present_section_nr(section_nr))
421 continue; 421 continue;
422 mem_sect = __nr_to_section(section_nr); 422 mem_sect = __nr_to_section(section_nr);
423 mem_blk = find_memory_block(mem_sect); 423 mem_blk = find_memory_block_hinted(mem_sect, mem_blk);
424 ret = register_mem_sect_under_node(mem_blk, nid); 424 ret = register_mem_sect_under_node(mem_blk, nid);
425 if (!err) 425 if (!err)
426 err = ret; 426 err = ret;
427 427
428 /* discard ref obtained in find_memory_block() */ 428 /* discard ref obtained in find_memory_block() */
429 kobject_put(&mem_blk->sysdev.kobj);
430 } 429 }
430
431 if (mem_blk)
432 kobject_put(&mem_blk->sysdev.kobj);
431 return err; 433 return err;
432} 434}
433 435