Commit 9afd0756 authored by Sharat Masetty's avatar Sharat Masetty Committed by Alex Deucher

drm/scheduler: Set sched->thread to NULL on failure

In cases where the scheduler instance is used as a base object of another
driver object, it's not clear if the driver can call scheduler cleanup on the
fail path. So, Set the sched->thread to NULL, so that the driver can safely
call drm_sched_fini() during cleanup.
Signed-off-by: default avatarSharat Masetty <smasetty@codeaurora.org>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 8288b2e5
...@@ -612,7 +612,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched, ...@@ -612,7 +612,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched,
long timeout, long timeout,
const char *name) const char *name)
{ {
int i; int i, ret;
sched->ops = ops; sched->ops = ops;
sched->hw_submission_limit = hw_submission; sched->hw_submission_limit = hw_submission;
sched->name = name; sched->name = name;
...@@ -633,8 +633,10 @@ int drm_sched_init(struct drm_gpu_scheduler *sched, ...@@ -633,8 +633,10 @@ int drm_sched_init(struct drm_gpu_scheduler *sched,
/* Each scheduler will run on a seperate kernel thread */ /* Each scheduler will run on a seperate kernel thread */
sched->thread = kthread_run(drm_sched_main, sched, sched->name); sched->thread = kthread_run(drm_sched_main, sched, sched->name);
if (IS_ERR(sched->thread)) { if (IS_ERR(sched->thread)) {
ret = PTR_ERR(sched->thread);
sched->thread = NULL;
DRM_ERROR("Failed to create scheduler for %s.\n", name); DRM_ERROR("Failed to create scheduler for %s.\n", name);
return PTR_ERR(sched->thread); return ret;
} }
sched->ready = true; sched->ready = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment