From 4adb652392591c8859ed8f69716a009d8d7fe29a Mon Sep 17 00:00:00 2001 From: David Rosca Date: Wed, 9 Oct 2024 11:14:23 +0200 Subject: [PATCH] frontends/va: Don't relock mutex in vlVaEndPicture While this should not cause any real issues, there is no reason to unlock the mutex just to lock it again couple lines below. Fixes coverity issue 1559431 Value not atomically updated Acked-by: Leo Liu Part-of: --- src/gallium/frontends/va/picture.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/gallium/frontends/va/picture.c b/src/gallium/frontends/va/picture.c index 0e038e78839..ae3e51c9019 100644 --- a/src/gallium/frontends/va/picture.c +++ b/src/gallium/frontends/va/picture.c @@ -1126,15 +1126,19 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) mtx_lock(&drv->mutex); context = handle_table_get(drv->htab, context_id); - mtx_unlock(&drv->mutex); - if (!context) + if (!context) { + mtx_unlock(&drv->mutex); return VA_STATUS_ERROR_INVALID_CONTEXT; + } if (!context->decoder) { - if (context->templat.profile != PIPE_VIDEO_PROFILE_UNKNOWN) + if (context->templat.profile != PIPE_VIDEO_PROFILE_UNKNOWN) { + mtx_unlock(&drv->mutex); return VA_STATUS_ERROR_INVALID_CONTEXT; + } /* VPP */ + mtx_unlock(&drv->mutex); return VA_STATUS_SUCCESS; } @@ -1142,7 +1146,6 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) out_target = &context->target; apply_av1_fg = vlVaQueryApplyFilmGrainAV1(context, &output_id, &out_target); - mtx_lock(&drv->mutex); surf = handle_table_get(drv->htab, output_id); vlVaGetSurfaceBuffer(drv, surf); if (!surf || !surf->buffer) {