[PATCH 1/2] drm/amdgpu: only deinitialize initialized ib's.

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Thu Aug 20 13:51:51 PDT 2015


Signed-off-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h    | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 2fc58e6..454d4e2 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1250,6 +1250,7 @@ struct amdgpu_cs_parser {
 
 	struct amdgpu_ib	*ibs;
 	uint32_t		num_ibs;
+	uint32_t		num_initialized_ibs;
 
 	struct ww_acquire_ctx	ticket;
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index e4424b4..2c49dd4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -509,7 +509,7 @@ static void amdgpu_cs_parser_fini_late(struct amdgpu_cs_parser *parser)
 		drm_free_large(parser->chunks[i].kdata);
 	kfree(parser->chunks);
 	if (parser->ibs)
-		for (i = 0; i < parser->num_ibs; i++)
+		for (i = 0; i < parser->num_initialized_ibs; i++)
 			amdgpu_ib_free(parser->adev, &parser->ibs[i]);
 	kfree(parser->ibs);
 	if (parser->uf.bo)
@@ -708,6 +708,7 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev,
 		ib->length_dw = chunk_ib->ib_bytes / 4;
 		ib->flags = chunk_ib->flags;
 		ib->ctx = parser->ctx;
+                parser->num_initialized_ibs++;
 		j++;
 	}
 
-- 
2.5.0



More information about the dri-devel mailing list