Skip to content

Commit f025a2b

Browse files
amd-sukhatrialexdeucher
authored andcommitted
drm/amdgpu: clean up the amdgpu_cs_parser_bos
In low memory conditions, kmalloc can fail. In such conditions unlock the mutex for a clean exit. We do not need to amdgpu_bo_list_put as it's been handled in the amdgpu_cs_parser_fini. Fixes: 737da53 ("drm/amdgpu: update the functions to use amdgpu version of hmm") Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Closes: https://lore.kernel.org/r/202602030017.7E0xShmH-lkp@intel.com/ Signed-off-by: Sunil Khatri <sunil.khatri@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 3b948dd commit f025a2b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -892,8 +892,10 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
892892
struct amdgpu_bo *bo = e->bo;
893893

894894
e->range = amdgpu_hmm_range_alloc(NULL);
895-
if (unlikely(!e->range))
896-
return -ENOMEM;
895+
if (unlikely(!e->range)) {
896+
r = -ENOMEM;
897+
goto out_free_user_pages;
898+
}
897899

898900
r = amdgpu_ttm_tt_get_user_pages(bo, e->range);
899901
if (r)

0 commit comments

Comments
 (0)