diff options
| author | Jason Gunthorpe <jgg@nvidia.com> | 2020-11-17 15:20:26 -0400 |
|---|---|---|
| committer | Jason Gunthorpe <jgg@nvidia.com> | 2020-11-17 15:20:26 -0400 |
| commit | bf3b7b7ba9e3db55d164ec7bf05e6947f79637cd (patch) | |
| tree | 7de81ebc8339c2a985b2af0e360368e281564c93 /drivers/of/of_reserved_mem.c | |
| parent | 8a7904a672a1d33c848e5129f886ee69e0773a2e (diff) | |
| parent | dabbd6abcdbeb1358a53ec28a244429320eb0e3a (diff) | |
| download | lwn-bf3b7b7ba9e3db55d164ec7bf05e6947f79637cd.tar.gz lwn-bf3b7b7ba9e3db55d164ec7bf05e6947f79637cd.zip | |
Merge branch 'for-rc' into rdma.git
From https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git
The rc RDMA branch is needed due to dependencies on the next patches.
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
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; |
