Commit 3bb45618 authored by Markus Elfring's avatar Markus Elfring Committed by Luben Tuikov

drm/sched: One function call less in drm_sched_init() after error detection

The kfree() function was called in one case by the
drm_sched_init() function during error handling
even if the passed data structure member contained a null pointer.
This issue was detected by using the Coccinelle software.

Thus adjust a jump target.
Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Link: https://patchwork.freedesktop.org/patch/msgid/85066512-983d-480c-a44d-32405ab1b80e@web.deReviewed-by: default avatarLuben Tuikov <ltuikov89@gmail.com>
Signed-off-by: default avatarLuben Tuikov <ltuikov89@gmail.com>
parent 5343f29b
...@@ -1289,7 +1289,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched, ...@@ -1289,7 +1289,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched,
sched->sched_rq = kmalloc_array(num_rqs, sizeof(*sched->sched_rq), sched->sched_rq = kmalloc_array(num_rqs, sizeof(*sched->sched_rq),
GFP_KERNEL | __GFP_ZERO); GFP_KERNEL | __GFP_ZERO);
if (!sched->sched_rq) if (!sched->sched_rq)
goto Out_free; goto Out_check_own;
sched->num_rqs = num_rqs; sched->num_rqs = num_rqs;
for (i = DRM_SCHED_PRIORITY_KERNEL; i < sched->num_rqs; i++) { for (i = DRM_SCHED_PRIORITY_KERNEL; i < sched->num_rqs; i++) {
sched->sched_rq[i] = kzalloc(sizeof(*sched->sched_rq[i]), GFP_KERNEL); sched->sched_rq[i] = kzalloc(sizeof(*sched->sched_rq[i]), GFP_KERNEL);
...@@ -1314,9 +1314,10 @@ int drm_sched_init(struct drm_gpu_scheduler *sched, ...@@ -1314,9 +1314,10 @@ int drm_sched_init(struct drm_gpu_scheduler *sched,
Out_unroll: Out_unroll:
for (--i ; i >= DRM_SCHED_PRIORITY_KERNEL; i--) for (--i ; i >= DRM_SCHED_PRIORITY_KERNEL; i--)
kfree(sched->sched_rq[i]); kfree(sched->sched_rq[i]);
Out_free:
kfree(sched->sched_rq); kfree(sched->sched_rq);
sched->sched_rq = NULL; sched->sched_rq = NULL;
Out_check_own:
if (sched->own_submit_wq) if (sched->own_submit_wq)
destroy_workqueue(sched->submit_wq); destroy_workqueue(sched->submit_wq);
drm_err(sched, "%s: Failed to setup GPU scheduler--out of memory\n", __func__); drm_err(sched, "%s: Failed to setup GPU scheduler--out of memory\n", __func__);
......
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