mm/memory_hotplug.c: drop unnecessary checks from register_mem_sect_under_node()
authorOscar Salvador <[email protected]>
Fri, 17 Aug 2018 22:46:25 +0000 (15:46 -0700)
committerLinus Torvalds <[email protected]>
Fri, 17 Aug 2018 23:20:29 +0000 (16:20 -0700)
Callers of register_mem_sect_under_node() are always passing a valid
memory_block (not NULL), so we can safely drop the check for NULL.

In the same way, register_mem_sect_under_node() is only called in case
the node is online, so we can safely remove that check as well.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Oscar Salvador <[email protected]>
Reviewed-by: Pavel Tatashin <[email protected]>
Tested-by: Reza Arbab <[email protected]>
Tested-by: Jonathan Cameron <[email protected]>
Cc: Pasha Tatashin <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
drivers/base/node.c

index 845d5523812b9f5eb21085b74a9e17014b7a6270..1ac4c36e13bbd9a70a07ba310e01bc053614c103 100644 (file)
@@ -404,12 +404,7 @@ int register_mem_sect_under_node(struct memory_block *mem_blk, void *arg)
        int ret, nid = *(int *)arg;
        unsigned long pfn, sect_start_pfn, sect_end_pfn;
 
-       if (!mem_blk)
-               return -EFAULT;
-
        mem_blk->nid = nid;
-       if (!node_online(nid))
-               return 0;
 
        sect_start_pfn = section_nr_to_pfn(mem_blk->start_section_nr);
        sect_end_pfn = section_nr_to_pfn(mem_blk->end_section_nr);