s390/vmemmap: cleanup when vmemmap_populate() fails

Cleanup what we partially added in case vmemmap_populate() fails. For
vmem, this is already handled by vmem_add_mapping().

Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20200722094558.9828-5-david@redhat.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
David Hildenbrand 2020-07-22 11:45:53 +02:00 committed by Heiko Carstens
parent 9ec8fa8dc3
commit c00f05a924
1 changed files with 6 additions and 1 deletions

View File

@ -332,8 +332,13 @@ static void vmem_remove_range(unsigned long start, unsigned long size)
int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
struct vmem_altmap *altmap)
{
int ret;
/* We don't care about the node, just use NUMA_NO_NODE on allocations */
return add_pagetable(start, end, false);
ret = add_pagetable(start, end, false);
if (ret)
remove_pagetable(start, end, false);
return ret;
}
void vmemmap_free(unsigned long start, unsigned long end,