summaryrefslogtreecommitdiff
path: root/mm/memblock.c
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2021-10-04 16:44:16 -0600
committerJonathan Corbet <corbet@lwn.net>2021-10-04 16:44:16 -0600
commitb718f9d919d16fb7b97a890f74d34593d9cecd20 (patch)
treeed38d58283ae36e0478bac2e0d244e06dbcc2f1c /mm/memblock.c
parent250a0a5ba9d2cfbdb7c77b421ff1e03d630bea46 (diff)
parent9e1ff307c779ce1f0f810c7ecce3d95bbae40896 (diff)
Merge tag 'v5.15-rc4' into docs-next
This is needed to get a docs fix that entered via the DRM tree; testers have requested it so that PDF builds in docs-next work again.
Diffstat (limited to 'mm/memblock.c')
-rw-r--r--mm/memblock.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/mm/memblock.c b/mm/memblock.c
index 0ab5a749bfa6..184dcd2e5d99 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -472,7 +472,7 @@ static int __init_memblock memblock_double_array(struct memblock_type *type,
kfree(old_array);
else if (old_array != memblock_memory_init_regions &&
old_array != memblock_reserved_init_regions)
- memblock_free(__pa(old_array), old_alloc_size);
+ memblock_free_ptr(old_array, old_alloc_size);
/*
* Reserve the new array if that comes from the memblock. Otherwise, we
@@ -796,6 +796,20 @@ int __init_memblock memblock_remove(phys_addr_t base, phys_addr_t size)
}
/**
+ * memblock_free_ptr - free boot memory allocation
+ * @ptr: starting address of the boot memory allocation
+ * @size: size of the boot memory block in bytes
+ *
+ * Free boot memory block previously allocated by memblock_alloc_xx() API.
+ * The freeing memory will not be released to the buddy allocator.
+ */
+void __init_memblock memblock_free_ptr(void *ptr, size_t size)
+{
+ if (ptr)
+ memblock_free(__pa(ptr), size);
+}
+
+/**
* memblock_free - free boot memory block
* @base: phys starting address of the boot memory block
* @size: size of the boot memory block in bytes