diff options
author | Mark Brown <broonie@kernel.org> | 2020-12-11 17:49:01 +0000 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2020-12-11 17:49:01 +0000 |
commit | 3e98a021cc85e7d52acdd1eae8a988e975ec5bf9 (patch) | |
tree | cecfac58b9550a602555a02a9d583ed0f3378b38 /drivers/of/of_reserved_mem.c | |
parent | 58f7553fa424fd0fd74e8b796d50c66014cebebe (diff) | |
parent | 2fee9583198eb97b5351feda7bd825e0f778385c (diff) |
Merge remote-tracking branch 'spi/for-5.11' into spi-next
Diffstat (limited to 'drivers/of/of_reserved_mem.c')
-rw-r--r-- | drivers/of/of_reserved_mem.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index bcd154485972..a7fbc5e37e19 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -200,6 +200,16 @@ static int __init __rmem_cmp(const void *a, const void *b) if (ra->base > rb->base) return 1; + /* + * Put the dynamic allocations (address == 0, size == 0) before static + * allocations at address 0x0 so that overlap detection works + * correctly. + */ + if (ra->size < rb->size) + return -1; + if (ra->size > rb->size) + return 1; + return 0; } @@ -217,8 +227,7 @@ static void __init __rmem_check_for_overlap(void) this = &reserved_mem[i]; next = &reserved_mem[i + 1]; - if (!(this->base && next->base)) - continue; + if (this->base + this->size > next->base) { phys_addr_t this_end, next_end; |