xen/unpopulated-alloc: fix error return code in fill_list()
authorZhen Lei <thunder.leizhen@huawei.com>
Sat, 8 May 2021 02:19:13 +0000 (10:19 +0800)
committerJuergen Gross <jgross@suse.com>
Mon, 10 May 2021 07:42:25 +0000 (09:42 +0200)
Fix to return a negative error code from the error handling case instead
of 0, as done elsewhere in this function.

Fixes: a4574f63edc6 ("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>
drivers/xen/unpopulated-alloc.c

index e64e6befc63b745d1f97f7fdb0a428e1a931e96b..87e6b7db892f54645aea32030687236919f9ea1c 100644 (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) {