[PATCH 1/2] drm/scheduler: always put last_sched fence in entity_fini

Pixel Ding Pixel.Ding at amd.com
Wed Apr 18 08:45:18 UTC 2018


Fix the potential memleak since scheduler main thread always
hold one last_sched fence.

Signed-off-by: Pixel Ding <Pixel.Ding at amd.com>
---
 drivers/gpu/drm/scheduler/gpu_scheduler.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c b/drivers/gpu/drm/scheduler/gpu_scheduler.c
index 44d21981bf3b..4968867da7a6 100644
--- a/drivers/gpu/drm/scheduler/gpu_scheduler.c
+++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c
@@ -276,10 +276,10 @@ void drm_sched_entity_cleanup(struct drm_gpu_scheduler *sched,
 			else if (r)
 				DRM_ERROR("fence add callback failed (%d)\n", r);
 		}
-
-		dma_fence_put(entity->last_scheduled);
-		entity->last_scheduled = NULL;
 	}
+
+	dma_fence_put(entity->last_scheduled);
+	entity->last_scheduled = NULL;
 }
 EXPORT_SYMBOL(drm_sched_entity_cleanup);
 
-- 
2.11.0



More information about the amd-gfx mailing list