aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Yang <richard.weiyang@gmail.com>2017-02-22 18:45:04 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-22 19:41:29 -0500
commitef415ef41153b747031e8ad965cb3df4f22ff72e (patch)
treef1fe360440def0dff05ae3e60a101c11b4d56d41
parent399d8eebe768fe3ae648700547d04f2a8796a4da (diff)
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/1482363033-24754-2-git-send-email-richard.weiyang@gmail.com Signed-off-by: Wei Yang <richard.weiyang@gmail.com> Acked-by: Michal Hocko <mhocko@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/memblock.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/mm/memblock.c b/mm/memblock.c
index a476d28e0733..90171d508b09 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1640,8 +1640,7 @@ int __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t size
1640 1640
1641 if (idx == -1) 1641 if (idx == -1)
1642 return 0; 1642 return 0;
1643 return memblock.memory.regions[idx].base <= base && 1643 return (memblock.memory.regions[idx].base +
1644 (memblock.memory.regions[idx].base +
1645 memblock.memory.regions[idx].size) >= end; 1644 memblock.memory.regions[idx].size) >= end;
1646} 1645}
1647 1646