Commit e123b4ed authored by Lucas Stach's avatar Lucas Stach Committed by Daniel Vetter

drm/etnaviv: avoid cleaning up sched_job when submit succeeded

While the labels may mislead the casual reader, the tail of the function
etnaviv_ioctl_gem_submit is always executed, as a lot of the structures
set up in this function need to be cleaned up regardless of whether the
submit succeeded or failed.

An exception is the newly added drm_sched_job_cleanup, which must only
be called when the submit failed before handing the job to the
scheduler.

Fixes: b827c84f ("drm/etnaviv: Use scheduler dependency handling")
Reported-by: default avatarMichael Walle <michael@walle.cc>
Signed-off-by: default avatarLucas Stach <l.stach@pengutronix.de>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20220504090229.2506560-1-l.stach@pengutronix.de
parent 420f95b0
...@@ -598,7 +598,12 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data, ...@@ -598,7 +598,12 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
sync_file = sync_file_create(submit->out_fence); sync_file = sync_file_create(submit->out_fence);
if (!sync_file) { if (!sync_file) {
ret = -ENOMEM; ret = -ENOMEM;
goto err_submit_job; /*
* When this late error is hit, the submit has already
* been handed over to the scheduler. At this point
* the sched_job must not be cleaned up.
*/
goto err_submit_put;
} }
fd_install(out_fence_fd, sync_file->file); fd_install(out_fence_fd, sync_file->file);
} }
...@@ -607,7 +612,8 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data, ...@@ -607,7 +612,8 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
args->fence = submit->out_fence_id; args->fence = submit->out_fence_id;
err_submit_job: err_submit_job:
drm_sched_job_cleanup(&submit->sched_job); if (ret)
drm_sched_job_cleanup(&submit->sched_job);
err_submit_put: err_submit_put:
etnaviv_submit_put(submit); etnaviv_submit_put(submit);
......
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