There's no point subtracting -1 from the calculated addresses and then
check for a <= b. Just remove the -1 and check for a < b.

Signed-off-by: Ilias Apalodimas <[email protected]>
---
 lib/lmb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/lmb.c b/lib/lmb.c
index a7ecbb58831f..c7bf5120696f 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -36,10 +36,10 @@ DECLARE_GLOBAL_DATA_PTR;
 static long lmb_addrs_overlap(phys_addr_t base1, phys_size_t size1,
                              phys_addr_t base2, phys_size_t size2)
 {
-       const phys_addr_t base1_end = base1 + size1 - 1;
-       const phys_addr_t base2_end = base2 + size2 - 1;
+       const phys_addr_t base1_end = base1 + size1;
+       const phys_addr_t base2_end = base2 + size2;
 
-       return ((base1 <= base2_end) && (base2 <= base1_end));
+       return ((base1 < base2_end) && (base2 < base1_end));
 }
 
 static long lmb_addrs_adjacent(phys_addr_t base1, phys_size_t size1,
-- 
2.45.2

Reply via email to