Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9ee8ecbb authored by Monk Liu's avatar Monk Liu Committed by Alex Deucher
Browse files

drm/amdgpu:fix memleak in takedown



this can fix the memory leak under the case that not all
BO are freed during "takedown" stage, because originally
it blocks following kfree on mgr.

Signed-off-by: default avatarMonk Liu <Monk.Liu@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 451cc55d
Loading
Loading
Loading
Loading
+0 −6
Original line number Original line Diff line number Diff line
@@ -71,12 +71,6 @@ static int amdgpu_gtt_mgr_fini(struct ttm_mem_type_manager *man)
{
{
	struct amdgpu_gtt_mgr *mgr = man->priv;
	struct amdgpu_gtt_mgr *mgr = man->priv;


	spin_lock(&mgr->lock);
	if (!drm_mm_clean(&mgr->mm)) {
		spin_unlock(&mgr->lock);
		return -EBUSY;
	}

	drm_mm_takedown(&mgr->mm);
	drm_mm_takedown(&mgr->mm);
	spin_unlock(&mgr->lock);
	spin_unlock(&mgr->lock);
	kfree(mgr);
	kfree(mgr);
+0 −5
Original line number Original line Diff line number Diff line
@@ -68,11 +68,6 @@ static int amdgpu_vram_mgr_fini(struct ttm_mem_type_manager *man)
	struct amdgpu_vram_mgr *mgr = man->priv;
	struct amdgpu_vram_mgr *mgr = man->priv;


	spin_lock(&mgr->lock);
	spin_lock(&mgr->lock);
	if (!drm_mm_clean(&mgr->mm)) {
		spin_unlock(&mgr->lock);
		return -EBUSY;
	}

	drm_mm_takedown(&mgr->mm);
	drm_mm_takedown(&mgr->mm);
	spin_unlock(&mgr->lock);
	spin_unlock(&mgr->lock);
	kfree(mgr);
	kfree(mgr);