From 74018f41ab469641091514767ea02e793e645601 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Thu, 25 Sep 2025 18:46:44 +0000 Subject: [PATCH] anv: try to help coverity understand we're not racing Coverity notices that in this case part of the decision to go down the locked path invovles reading a flag, which is turn set inside the protected code. Additional threads can decide they need to go down the locked path, and then wait on the lock, even though the first thread willse the device_registered to true, which would have otherwise prevented them from going down the locked path. What Coverity doesn't know, is that it is a violation of the Vulkan API contract to call this function from two different threads, so in practice that cann't happen. We'll move the setting of the image_device_registered out of the locked area to see if that pacifies Coverity, and if not then we'll just ignore it. CID: 1662067 Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/vulkan/anv_image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index 94d65611cee..48fc61f2de5 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -3151,8 +3151,8 @@ anv_bind_image_memory(struct anv_device *device, !image->device_registered) { pthread_mutex_lock(&device->mutex); list_addtail(&image->link, &device->image_private_objects); - image->device_registered = true; pthread_mutex_unlock(&device->mutex); + image->device_registered = true; } if (bind_status)