summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSharat Masetty <smasetty@codeaurora.org>2018-11-29 13:05:19 +0300
committerAlex Deucher <alexander.deucher@amd.com>2018-12-06 01:56:16 +0300
commit9afd07566b6c908324cb4072102e2ce96bce986a (patch)
tree4f24cc18d4fa7684306aab44c062fb87d76b864f /drivers
parent8288b2e5ae01cabd078836618fd651574343cbfc (diff)
downloadlinux-9afd07566b6c908324cb4072102e2ce96bce986a.tar.xz
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: Sharat Masetty <smasetty@codeaurora.org> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/scheduler/sched_main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
index 9d4cd196037a..05b803d1248d 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -612,7 +612,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched,
long timeout,
const char *name)
{
- int i;
+ int i, ret;
sched->ops = ops;
sched->hw_submission_limit = hw_submission;
sched->name = name;
@@ -633,8 +633,10 @@ int drm_sched_init(struct drm_gpu_scheduler *sched,
/* Each scheduler will run on a seperate kernel thread */
sched->thread = kthread_run(drm_sched_main, sched, sched->name);
if (IS_ERR(sched->thread)) {
+ ret = PTR_ERR(sched->thread);
+ sched->thread = NULL;
DRM_ERROR("Failed to create scheduler for %s.\n", name);
- return PTR_ERR(sched->thread);
+ return ret;
}
sched->ready = true;