Coverity warns about initializing variables that will later be accessed under a mutex. There is no problem with the code itself but let's avoid accumulating Coverity warnings.
Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com> --- iothread.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/iothread.c b/iothread.c index cb5986b..9e25af9 100644 --- a/iothread.c +++ b/iothread.c @@ -75,11 +75,14 @@ static void iothread_complete(UserCreatable *obj, Error **errp) iothread->stopping = false; iothread->ctx = aio_context_new(); - iothread->thread_id = -1; qemu_mutex_init(&iothread->init_done_lock); qemu_cond_init(&iothread->init_done_cond); + qemu_mutex_lock(&iothread->init_done_lock); + iothread->thread_id = -1; + qemu_mutex_unlock(&iothread->init_done_lock); + /* This assumes we are called from a thread with useful CPU affinity for us * to inherit. */ -- 1.8.5.3