[PATCH] drm/amdgpu: fix the issue that nodes[0] is not removed from the allocator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Change-Id: Id960af4bf93036a8a39306c374e2cafdc1bef055
Signed-off-by: JimQu <Jim.Qu at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
index 180eed7c..6933f4a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
@@ -100,7 +100,7 @@ static int amdgpu_vram_mgr_new(struct ttm_mem_type_manager *man,
 	enum drm_mm_search_flags sflags = DRM_MM_SEARCH_DEFAULT;
 	enum drm_mm_allocator_flags aflags = DRM_MM_CREATE_DEFAULT;
 	unsigned long lpfn, num_nodes, pages_per_node, pages_left;
-	unsigned i;
+	unsigned i, j;
 	int r;
 
 	lpfn = place->lpfn;
@@ -155,8 +155,8 @@ static int amdgpu_vram_mgr_new(struct ttm_mem_type_manager *man,
 	return 0;
 
 error:
-	while (i--)
-		drm_mm_remove_node(&nodes[i]);
+	for (j = 0; j < i; j++)
+		drm_mm_remove_node(&nodes[j]);
 	spin_unlock(&mgr->lock);
 
 	kfree(nodes);
-- 
1.9.1



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux