[PATCH 1/2] drm/amdgpu: fix amdgpu_job_free_resources v2
Alex Deucher
alexdeucher at gmail.com
Mon Jan 16 20:15:49 UTC 2023
On Mon, Jan 16, 2023 at 3:12 PM Christian König
<ckoenig.leichtzumerken at gmail.com> wrote:
>
> It can be that neither fence were initialized when we run out of UVD
> streams for example.
>
> v2: fix typo breaking compile
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> index f4a3122352de..6b73c074aa25 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> @@ -154,8 +154,14 @@ void amdgpu_job_free_resources(struct amdgpu_job *job)
> struct dma_fence *f;
> unsigned i;
>
> - /* use sched fence if available */
> - f = job->base.s_fence ? &job->base.s_fence->finished : &job->hw_fence;
> + /* Check if any fences where initialized */
> + if (job->base.s_fence && job->base.s_fence->finished.ops)
> + f = &job->base.s_fence->finished;
> + else if (job->hw_fence.ops)
> + f = &job->hw_fence;
> + else
> + f = NULL;
> +
> for (i = 0; i < job->num_ibs; ++i)
> amdgpu_ib_free(ring->adev, &job->ibs[i], f);
> }
> --
> 2.34.1
>
More information about the amd-gfx
mailing list