turnip: Release bo_mutex lock before potential error path.
authorVinson Lee <vlee@freedesktop.org>
Thu, 17 Sep 2020 23:08:41 +0000 (16:08 -0700)
committerMarge Bot <eric+marge@anholt.net>
Thu, 17 Sep 2020 23:27:40 +0000 (23:27 +0000)
Fix defect reported by Coverity Scan.

Missing unlock (LOCK)
missing_unlock: Returning without unlocking queue->device->bo_mutex.

Suggested-by: Jonathan Marek <jonathan@marek.ca>
Fixes: bea6290ca090 ("turnip: device global bo list")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6768>

src/freedreno/vulkan/tu_drm.c

index fb3bb19..ca1403f 100644 (file)
@@ -746,13 +746,12 @@ tu_QueueSubmit(VkQueue _queue,
       int ret = drmCommandWriteRead(queue->device->physical_device->local_fd,
                                     DRM_MSM_GEM_SUBMIT,
                                     &req, sizeof(req));
+      mtx_unlock(&queue->device->bo_mutex);
       if (ret) {
          return tu_device_set_lost(queue->device, "submit failed: %s\n",
                                    strerror(errno));
       }
 
-      mtx_unlock(&queue->device->bo_mutex);
-
       tu_semaphores_remove_temp(queue->device, pSubmits[i].pWaitSemaphores,
                                 pSubmits[i].waitSemaphoreCount);
       if (last_submit) {