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

Submitted by Huang, Ray on Sept. 10, 2018, 8:57 a.m.

Details

Message ID 1536569876-27262-2-git-send-email-ray.huang@amd.com
State New
Headers show
Series "Series without cover letter" ( rev: 2 1 ) in DRI devel

Not browsing as part of any series.

Commit Message

Huang, Ray Sept. 10, 2018, 8:57 a.m.
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(+)

Patch hide | download patch | download mbox

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;
 }
 
 /**