From 8d08dbb0b24d54b199c0fa1b39232ae8b73155d4 Mon Sep 17 00:00:00 2001 From: Monk Liu Date: Mon, 30 May 2016 15:13:59 +0800 Subject: [PATCH 1108/1110] drm/amdgpu:fix uvd fini mem leak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I970ff5639fd22464a494750956646296b932ba3c Signed-off-by: Monk Liu Reviewed-by: Christian König Signed-off-by: Kalyan Alle --- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c index 88a7942..efb07fe 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c @@ -244,11 +244,11 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev) int amdgpu_uvd_sw_fini(struct amdgpu_device *adev) { int r; - - if (adev->uvd.vcpu_bo == NULL) - return 0; + + kfree(adev->uvd.saved_bo); amd_sched_entity_fini(&adev->uvd.ring.sched, &adev->uvd.entity); - + + if (adev->uvd.vcpu_bo) { r = amdgpu_bo_reserve(adev->uvd.vcpu_bo, false); if (!r) { amdgpu_bo_kunmap(adev->uvd.vcpu_bo); @@ -257,7 +257,7 @@ int amdgpu_uvd_sw_fini(struct amdgpu_device *adev) } amdgpu_bo_unref(&adev->uvd.vcpu_bo); - + } amdgpu_ring_fini(&adev->uvd.ring); release_firmware(adev->uvd.fw); @@ -280,8 +280,10 @@ int amdgpu_uvd_suspend(struct amdgpu_device *adev) if (i == AMDGPU_MAX_UVD_HANDLES) return 0; - - size = amdgpu_bo_size(adev->uvd.vcpu_bo); + + cancel_delayed_work_sync(&adev->uvd.idle_work); + + size = amdgpu_bo_size(adev->uvd.vcpu_bo); ptr = adev->uvd.cpu_addr; adev->uvd.saved_bo = kmalloc(size, GFP_KERNEL); @@ -301,8 +303,6 @@ int amdgpu_uvd_resume(struct amdgpu_device *adev) if (adev->uvd.vcpu_bo == NULL) return -EINVAL; - cancel_delayed_work_sync(&adev->uvd.idle_work); - size = amdgpu_bo_size(adev->uvd.vcpu_bo); ptr = adev->uvd.cpu_addr; @@ -916,7 +916,7 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo, amdgpu_job_free(job); } else { - r = amdgpu_job_submit(job, ring, NULL, + r = amdgpu_job_submit(job, ring, &adev->uvd.entity, AMDGPU_FENCE_OWNER_UNDEFINED, &f); if (r) goto err_free; -- 2.7.4