drm/amdgpu: free userptrs even if GTT isn't bound
This fixes a memory leak since binding GTT only on demand. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
3d5f4d4770
commit
85a4b5798f
|
@ -757,6 +757,9 @@ static int amdgpu_ttm_backend_unbind(struct ttm_tt *ttm)
|
||||||
{
|
{
|
||||||
struct amdgpu_ttm_tt *gtt = (void *)ttm;
|
struct amdgpu_ttm_tt *gtt = (void *)ttm;
|
||||||
|
|
||||||
|
if (gtt->userptr)
|
||||||
|
amdgpu_ttm_tt_unpin_userptr(ttm);
|
||||||
|
|
||||||
if (!amdgpu_ttm_is_bound(ttm))
|
if (!amdgpu_ttm_is_bound(ttm))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -764,9 +767,6 @@ static int amdgpu_ttm_backend_unbind(struct ttm_tt *ttm)
|
||||||
if (gtt->adev->gart.ready)
|
if (gtt->adev->gart.ready)
|
||||||
amdgpu_gart_unbind(gtt->adev, gtt->offset, ttm->num_pages);
|
amdgpu_gart_unbind(gtt->adev, gtt->offset, ttm->num_pages);
|
||||||
|
|
||||||
if (gtt->userptr)
|
|
||||||
amdgpu_ttm_tt_unpin_userptr(ttm);
|
|
||||||
|
|
||||||
spin_lock(>t->adev->gtt_list_lock);
|
spin_lock(>t->adev->gtt_list_lock);
|
||||||
list_del_init(>t->list);
|
list_del_init(>t->list);
|
||||||
spin_unlock(>t->adev->gtt_list_lock);
|
spin_unlock(>t->adev->gtt_list_lock);
|
||||||
|
|
Loading…
Reference in New Issue