drm/amdgpu: clean up the amdgpu_cs_parser_bos
Subsystems (2)
PATCH v5 1/1 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 737da5363cc0 ("drm/amdgpu: update the functions to use amdgpu version of hmm")
Reported-by kernel test robot <[email protected]>
Reported-by Dan Carpenter <[email protected]>
Signed-off-by Sunil Khatri <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +4 -2
@@ -892,8 +892,10 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,struct amdgpu_bo *bo = e->bo; e->range =amdgpu_hmm_range_alloc (NULL ); -if (unlikely (!e->range)) -return -ENOMEM ; +if (unlikely (!e->range)) { + r = -ENOMEM ; + goto out_free_user_pages; + } r =amdgpu_ttm_tt_get_user_pages (bo, e->range);if (r)
Signature · 1 line
2.34.1
Quoted 11 lines · Sunil Khatri
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_putas it's been handled in theamdgpu_cs_parser_fini.Fixes 737da5363cc0 ("drm/amdgpu: update the functions to use amdgpu version of hmm")Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>Signed-off-by Sunil Khatri <[email protected]>
Reviewed-by Christian König <[email protected]>
Quoted 21 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +4
-2@@ -892,8 +892,10 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,struct amdgpu_bo *bo = e->bo; e->range =amdgpu_hmm_range_alloc (NULL ); -if (unlikely (!e->range)) -return -ENOMEM ; +if (unlikely (!e->range)) { + r = -ENOMEM ; + goto out_free_user_pages; + } r =amdgpu_ttm_tt_get_user_pages (bo, e->range);if (r)