v3dv: initialize fd variable for proper error handling
authorMaíra Canal <mcanal@igalia.com>
Sat, 31 Dec 2022 13:44:18 +0000 (10:44 -0300)
committerEric Engestrom <eric@engestrom.ch>
Wed, 11 Jan 2023 17:44:21 +0000 (17:44 +0000)
Currently, process_singlesync_signals() checks if fd == -1 to handle
possible errors in the drmSyncobjExportSyncFile function. But, fd is not
initialized, which means that drmSyncobjExportSyncFile might fail and
the error will not be handled as fd might not be equal to -1.

Therefore, initialize the fd variable with value -1 to ensure proper
error handling.

cc: mesa-stable

Signed-off-by: Maíra Canal <mcanal@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20475>
(cherry picked from commit a2252adde8235d5c4d78d9347527cd7914bb905a)

.pick_status.json
src/broadcom/vulkan/v3dv_queue.c

index 5df9eec..d0c2ce7 100644 (file)
         "description": "v3dv: initialize fd variable for proper error handling",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
index db2aae1..37afbc9 100644 (file)
@@ -484,7 +484,7 @@ process_singlesync_signals(struct v3dv_queue *queue,
    if (device->pdevice->caps.multisync)
       return VK_SUCCESS;
 
-   int fd;
+   int fd = -1;
    drmSyncobjExportSyncFile(device->pdevice->render_fd,
                             queue->last_job_syncs.syncs[V3DV_QUEUE_ANY],
                             &fd);