mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 05:31:08 -04:00
mm/memblock.c: trivial code refine in memblock_is_region_memory()
memblock_is_region_memory() invoke memblock_search() to see whether the base address is in the memory region. If it fails, idx would be -1. Then, it returns 0. If the memblock_search() returns a valid index, it means the base address is guaranteed to be in the range memblock.memory.regions[idx]. Because of this, it is not necessary to check the base again. This patch removes the check on "base". Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Wei Yang <[email protected]> Acked-by: Michal Hocko <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
1 parent
399d8eebe7
commit
ef415ef411
1 file changed
+1
-2
+1
-2
@@ -1640,8 +1640,7 @@ int __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t size
|
||||
|
||||
if (idx == -1)
|
||||
return 0;
|
||||
return memblock.memory.regions[idx].base <= base &&
|
||||
(memblock.memory.regions[idx].base +
|
||||
return (memblock.memory.regions[idx].base +
|
||||
memblock.memory.regions[idx].size) >= end;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user