Commit ca2c36ca authored by David Hildenbrand's avatar David Hildenbrand Committed by Michael Ellerman

powerpc/mm: remove linear mapping if __add_pages() fails in arch_add_memory()

Let's revert what we did in case something goes wrong and we return an
error - as already done on arm64 and s390x.
Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
Reviewed-by: default avatarOscar Salvador <osalvador@suse.de>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201111145322.15793-8-david@redhat.com
parent d8bd9a12
......@@ -170,7 +170,10 @@ int __ref arch_add_memory(int nid, u64 start, u64 size,
rc = arch_create_linear_mapping(nid, start, size, params);
if (rc)
return rc;
return __add_pages(nid, start_pfn, nr_pages, params);
rc = __add_pages(nid, start_pfn, nr_pages, params);
if (rc)
arch_remove_linear_mapping(start, size);
return rc;
}
void __ref arch_remove_memory(int nid, u64 start, u64 size,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment