xen/unpopulated-alloc: fix error return code in fill_list()

[ Upstream commit dbc03e81586fc33e4945263fd6e09e22eb4b980f ]

Fix to return a negative error code from the error handling case instead
of 0, as done elsewhere in this function.

Fixes: a4574f63ed ("mm/memremap_pages: convert to 'struct range'")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/20210508021913.1727-1-thunder.leizhen@huawei.com
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Zhen Lei 2021-05-08 10:19:13 +08:00 committed by Greg Kroah-Hartman
parent 0581225726
commit 1d8d7e02f6

View File

@ -39,8 +39,10 @@ static int fill_list(unsigned int nr_pages)
}
pgmap = kzalloc(sizeof(*pgmap), GFP_KERNEL);
if (!pgmap)
if (!pgmap) {
ret = -ENOMEM;
goto err_pgmap;
}
pgmap->type = MEMORY_DEVICE_GENERIC;
pgmap->range = (struct range) {