mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 07:18:17 +02:00
anv: Get rid of "may be used initialized" warning in anv_QueueSubmit2KHR
The code is correct, but compiler can't see it. Initialize the value
to NULL and assert on it if the function succeeds. It both helps the
compiler and make the code slightly more robust.
```
../src/intel/vulkan/anv_queue.c: In function ‘anv_QueueSubmit2KHR’:
../src/intel/vulkan/anv_queue.c:932:16: warning: ‘impl’ may be used uninitialized in this function [-Wmaybe-uninitialized]
932 | result = anv_queue_submit_add_timeline_wait(queue, submit,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
933 | &impl->timeline,
| ~~~~~~~~~~~~~~~~
934 | value);
| ~~~~~~
../src/intel/vulkan/anv_queue.c:899:31: note: ‘impl’ was declared here
899 | struct anv_semaphore_impl *impl;
| ^~~~
```
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13638>
This commit is contained in:
parent
3afdc3ab2c
commit
eb430aa9e7
1 changed files with 3 additions and 1 deletions
|
|
@ -896,13 +896,15 @@ anv_queue_submit_add_in_semaphore(struct anv_queue *queue,
|
|||
const uint64_t value)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_semaphore, semaphore, _semaphore);
|
||||
struct anv_semaphore_impl *impl;
|
||||
struct anv_semaphore_impl *impl = NULL;
|
||||
VkResult result;
|
||||
|
||||
result = maybe_transfer_temporary_semaphore(queue, submit, semaphore, &impl);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
assert(impl);
|
||||
|
||||
switch (impl->type) {
|
||||
case ANV_SEMAPHORE_TYPE_WSI_BO:
|
||||
/* When using a window-system buffer as a semaphore, always enable
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue