diff mbox series

[2/2] drm/amdgpu: set tbo pointer as null after amdgpu bo is freed

Message ID 1536569876-27262-2-git-send-email-ray.huang@amd.com (mailing list archive)
State New, archived
Headers show
Series [1/2] drm/ttm: set ttm_buffer_object pointer as null after it's freed | expand

Commit Message

Huang Rui Sept. 10, 2018, 8:57 a.m. UTC
The tbo pointer will still have value even the amdgpu bo is freed.
It doesn't make sense that it still points a freed memory. It could be refered
mistakenly, so set it as null.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Tom StDenis <Tom.StDenis@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index de990bd..ae84c08 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -108,6 +108,7 @@  static void amdgpu_bo_destroy(struct ttm_buffer_object *tbo)
 	}
 	kfree(bo->metadata);
 	kfree(bo);
+	tbo = NULL;
 }
 
 /**