diff options
author | Grazvydas Ignotas <[email protected]> | 2018-01-15 23:59:20 +0200 |
---|---|---|
committer | Grazvydas Ignotas <[email protected]> | 2018-01-17 00:39:55 +0200 |
commit | 0ad73031ec2f9dee6d3ad20dd625b0134ea8ec8b (patch) | |
tree | dec750458da9b93f2397750becdcc4900448a11c /src/gallium/state_trackers | |
parent | cce982a70be5e24c6f6ee222c17c47eb8cba6921 (diff) |
st/va: release held locks in error paths
Found with the help of following Coccinelle semantic patch:
// <smpl>
@@
expression E;
@@
\(pthread_mutex_lock\|mtx_lock\|simple_mtx_lock\)(E)
...
(
\(pthread_mutex_unlock\|mtx_unlock\|simple_mtx_unlock\)(E);
...
return ...;
|
+ maybe need_unlock(E);
return ...;
)
// </smpl>
Signed-off-by: Grazvydas Ignotas <[email protected]>
Reviewed-by: Christian König <[email protected]>
Cc: [email protected]
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r-- | src/gallium/state_trackers/va/config.c | 4 | ||||
-rw-r--r-- | src/gallium/state_trackers/va/image.c | 4 | ||||
-rw-r--r-- | src/gallium/state_trackers/va/picture.c | 4 |
3 files changed, 9 insertions, 3 deletions
diff --git a/src/gallium/state_trackers/va/config.c b/src/gallium/state_trackers/va/config.c index 25043d63742..7bc031a1a2f 100644 --- a/src/gallium/state_trackers/va/config.c +++ b/src/gallium/state_trackers/va/config.c @@ -308,8 +308,10 @@ vlVaDestroyConfig(VADriverContextP ctx, VAConfigID config_id) mtx_lock(&drv->mutex); config = handle_table_get(drv->htab, config_id); - if (!config) + if (!config) { + mtx_unlock(&drv->mutex); return VA_STATUS_ERROR_INVALID_CONFIG; + } FREE(config); handle_table_remove(drv->htab, config_id); diff --git a/src/gallium/state_trackers/va/image.c b/src/gallium/state_trackers/va/image.c index 86ae8685802..3f892c9842c 100644 --- a/src/gallium/state_trackers/va/image.c +++ b/src/gallium/state_trackers/va/image.c @@ -548,8 +548,10 @@ vlVaPutImage(VADriverContextP ctx, VASurfaceID surface, VAImageID image, PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD_RANGE, &dst_box, &transfer); - if (map == NULL) + if (map == NULL) { + mtx_unlock(&drv->mutex); return VA_STATUS_ERROR_OPERATION_FAILED; + } u_copy_nv12_from_yv12((const void * const*) data, pitches, i, j, transfer->stride, tex->array_size, diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c index 23a4b524d7b..22934e43ccd 100644 --- a/src/gallium/state_trackers/va/picture.c +++ b/src/gallium/state_trackers/va/picture.c @@ -682,9 +682,11 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id) vl_compositor_yuv_deint_full(&drv->cstate, &drv->compositor, old_buf, surf->buffer, &src_rect, &dst_rect, VL_COMPOSITOR_WEAVE); - } else + } else { /* Can't convert from progressive to interlaced yet */ + mtx_unlock(&drv->mutex); return VA_STATUS_ERROR_INVALID_SURFACE; + } } old_buf->destroy(old_buf); |