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/va/image.c | |
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/va/image.c')
-rw-r--r-- | src/gallium/state_trackers/va/image.c | 4 |
1 files changed, 3 insertions, 1 deletions
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, |