From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOTpJ-0005VG-V3 for qemu-devel@nongnu.org; Fri, 14 Mar 2014 11:15:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WOTpE-0004M1-0U for qemu-devel@nongnu.org; Fri, 14 Mar 2014 11:15:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6883) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOTpD-0004LM-Jz for qemu-devel@nongnu.org; Fri, 14 Mar 2014 11:15:07 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2EFF6mV009609 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 14 Mar 2014 11:15:07 -0400 From: Stefan Hajnoczi Date: Fri, 14 Mar 2014 16:14:58 +0100 Message-Id: <1394810099-21028-2-git-send-email-stefanha@redhat.com> In-Reply-To: <1394810099-21028-1-git-send-email-stefanha@redhat.com> References: <1394810099-21028-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PATCH 1/2] iothread: fix bogus coverity warning List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Markus Armbruster , Stefan Hajnoczi , "Dr. David Alan Gilbert" 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 --- 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