dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: Alex Deucher <alexander.deucher@amd.com>, Monk Liu <Monk.Liu@amd.com>
Subject: [PATCH 08/13] drm/amdgpu: fix uvd fini mem leak
Date: Thu,  2 Jun 2016 10:39:08 -0400	[thread overview]
Message-ID: <1464878353-16836-9-git-send-email-alexander.deucher@amd.com> (raw)
In-Reply-To: <1464878353-16836-1-git-send-email-alexander.deucher@amd.com>

From: Monk Liu <Monk.Liu@amd.com>

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
index 01abfc2..e19520c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
@@ -253,19 +253,20 @@ 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);
 
-	r = amdgpu_bo_reserve(adev->uvd.vcpu_bo, false);
-	if (!r) {
-		amdgpu_bo_kunmap(adev->uvd.vcpu_bo);
-		amdgpu_bo_unpin(adev->uvd.vcpu_bo);
-		amdgpu_bo_unreserve(adev->uvd.vcpu_bo);
-	}
+	if (adev->uvd.vcpu_bo) {
+		r = amdgpu_bo_reserve(adev->uvd.vcpu_bo, false);
+		if (!r) {
+			amdgpu_bo_kunmap(adev->uvd.vcpu_bo);
+			amdgpu_bo_unpin(adev->uvd.vcpu_bo);
+			amdgpu_bo_unreserve(adev->uvd.vcpu_bo);
+		}
 
-	amdgpu_bo_unref(&adev->uvd.vcpu_bo);
+		amdgpu_bo_unref(&adev->uvd.vcpu_bo);
+	}
 
 	amdgpu_ring_fini(&adev->uvd.ring);
 
-- 
2.5.5

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2016-06-02 14:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-02 14:39 [PATCH 00/13] Fix memory and firmware leaks Alex Deucher
2016-06-02 14:39 ` [PATCH 01/13] drm/amdgpu: fix mem leak in smumgr Alex Deucher
2016-06-02 14:39 ` [PATCH 02/13] drm/amdgpu: fix mem leak in pplib/hwmgr Alex Deucher
2016-06-02 14:39 ` [PATCH 03/13] drm/amdgpu: fix mem leak in atombios Alex Deucher
2016-06-02 14:39 ` [PATCH 04/13] drm/amdgpu: fix memleak in pptable_init Alex Deucher
2016-06-02 14:39 ` [PATCH 05/13] drm/amdgpu: fix missing free wb for cond_exec Alex Deucher
2016-06-02 14:39 ` [PATCH 06/13] drm/amdgpu: fix gfx8 ucode mem leak Alex Deucher
2016-06-02 14:39 ` [PATCH 07/13] drm/amdgpu: fix gfx 7 " Alex Deucher
2016-06-02 14:39 ` Alex Deucher [this message]
2016-06-02 14:39 ` [PATCH 09/13] drm/amdgpu: fix sdma3 " Alex Deucher
2016-06-02 14:39 ` [PATCH 10/13] drm/amdgpu: fix sdma24 " Alex Deucher
2016-06-02 14:39 ` [PATCH 11/13] drm/amdgpu: fix cik sdma ucode memleak Alex Deucher
2016-06-02 14:39 ` [PATCH 12/13] drm/amdgpu: fix fiji smu fini mem leak Alex Deucher
2016-06-02 14:39 ` [PATCH 13/13] drm/amdgpu: fix tonga smu_fini " Alex Deucher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1464878353-16836-9-git-send-email-alexander.deucher@amd.com \
    --to=alexdeucher@gmail.com \
    --cc=Monk.Liu@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox