[RFC PATCH 2/7] lmb: Simplify lmb_addrs_overlap()
Ilias Apalodimas
ilias.apalodimas at linaro.org
Sun Dec 8 11:52:05 CET 2024
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 <ilias.apalodimas at linaro.org>
---
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
More information about the U-Boot
mailing list