Skip to content

Commit 612b23f

Browse files
committed
Merge tag 'memblock-v5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock
Pull memblock updates from Mike Rapoport: "Robustness and debug improvements: - add check for memory add/cap ordering - add missing debug code to memblock_add_node()" * tag 'memblock-v5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock: memblock: Check memory add/cap ordering memblock: Add missing debug code to memblock_add_node()
2 parents 4a3bb42 + e888fa7 commit 612b23f

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

mm/memblock.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,11 @@ static int __init_memblock memblock_add_range(struct memblock_type *type,
665665
int __init_memblock memblock_add_node(phys_addr_t base, phys_addr_t size,
666666
int nid)
667667
{
668+
phys_addr_t end = base + size - 1;
669+
670+
memblock_dbg("%s: [%pa-%pa] nid=%d %pS\n", __func__,
671+
&base, &end, nid, (void *)_RET_IP_);
672+
668673
return memblock_add_range(&memblock.memory, base, size, nid, 0);
669674
}
670675

@@ -1680,6 +1685,11 @@ void __init memblock_cap_memory_range(phys_addr_t base, phys_addr_t size)
16801685
if (!size)
16811686
return;
16821687

1688+
if (memblock.memory.cnt <= 1) {
1689+
pr_warn("%s: No memory registered yet\n", __func__);
1690+
return;
1691+
}
1692+
16831693
ret = memblock_isolate_range(&memblock.memory, base, size,
16841694
&start_rgn, &end_rgn);
16851695
if (ret)

0 commit comments

Comments
 (0)