Moved free_vm_area from the __vmalloc_area_node function to the
__vmalloc_node_range_noprof function so that allocation and freeing of the
area can be paired in one function for better readability.
Link: https://lkml.kernel.org/r/20250303015702.319416-1-liuye@kylinos.cn
Signed-off-by: Liu Ye <liuye@kylinos.cn>
Cc: Christop Hellwig <hch@infradead.org>
Cc: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
warn_alloc(gfp_mask, NULL,
"vmalloc error: size %lu, failed to allocated page array size %lu",
nr_small_pages * PAGE_SIZE, array_size);
- free_vm_area(area);
return NULL;
}
/* Allocate physical pages and map them into vmalloc space. */
ret = __vmalloc_area_node(area, gfp_mask, prot, shift, node);
- if (!ret)
+ if (!ret) {
+ free_vm_area(area);
goto fail;
+ }
/*
* Mark the pages as accessible, now that they are mapped.