Skip to content

Commit 74ea8e7

Browse files
ChristianKoenigAMDalexdeucher
authored andcommitted
drm/amdgpu: fix amdgpu_job_free_resources v2
It can be that neither fence were initialized when we run out of UVD streams for example. v2: fix typo breaking compile Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2324 Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected] # 6.1.x
1 parent 973a9c8 commit 74ea8e7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_job.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,14 @@ void amdgpu_job_free_resources(struct amdgpu_job *job)
161161
struct dma_fence *f;
162162
unsigned i;
163163

164-
/* use sched fence if available */
165-
f = job->base.s_fence ? &job->base.s_fence->finished : &job->hw_fence;
164+
/* Check if any fences where initialized */
165+
if (job->base.s_fence && job->base.s_fence->finished.ops)
166+
f = &job->base.s_fence->finished;
167+
else if (job->hw_fence.ops)
168+
f = &job->hw_fence;
169+
else
170+
f = NULL;
171+
166172
for (i = 0; i < job->num_ibs; ++i)
167173
amdgpu_ib_free(ring->adev, &job->ibs[i], f);
168174
}

0 commit comments

Comments
 (0)