There should be no reason to call drmPrimeFDToHandle under the table_lock mutex. Instead of taking the lock early and releasing it in two places, just take it after trying to obtain the handle. Signed-off-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx> --- freedreno/freedreno_bo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/freedreno/freedreno_bo.c b/freedreno/freedreno_bo.c index 7f8ea59c..2eb38e45 100644 --- a/freedreno/freedreno_bo.c +++ b/freedreno/freedreno_bo.c @@ -135,13 +135,13 @@ fd_bo_from_dmabuf(struct fd_device *dev, int fd) uint32_t handle; struct fd_bo *bo; - pthread_mutex_lock(&table_lock); ret = drmPrimeFDToHandle(dev->fd, fd, &handle); if (ret) { - pthread_mutex_unlock(&table_lock); return NULL; } + pthread_mutex_lock(&table_lock); + bo = lookup_bo(dev->handle_table, handle); if (bo) goto out_unlock; -- 2.11.0 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel