From: Philip Yang Date: Fri, 29 Apr 2022 00:17:38 +0000 (-0400) Subject: drm/amdgpu: Free user pages if kvmalloc_array fails X-Git-Tag: v6.1-rc5~1171^2~7^2~381 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=068421b1730fe65fb4f73921fdb78c080b0c62f4;p=platform%2Fkernel%2Flinux-starfive.git drm/amdgpu: Free user pages if kvmalloc_array fails To cleanup the BOs of bo_list which have got user pages. Signed-off-by: Philip Yang Reviewed-by: Christian König Reviewed-by: Felix Kuehling Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index 67bd506..e05ace2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -543,7 +543,8 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, GFP_KERNEL | __GFP_ZERO); if (!e->user_pages) { DRM_ERROR("kvmalloc_array failure\n"); - return -ENOMEM; + r = -ENOMEM; + goto out_free_user_pages; } r = amdgpu_ttm_tt_get_user_pages(bo, e->user_pages);