From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37261) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCRUP-0002QY-4K for qemu-devel@nongnu.org; Fri, 14 Sep 2012 04:43:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TCRUJ-0007b0-CV for qemu-devel@nongnu.org; Fri, 14 Sep 2012 04:43:05 -0400 Received: from mail-wg0-f53.google.com ([74.125.82.53]:61607) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCRUJ-0007aq-6F for qemu-devel@nongnu.org; Fri, 14 Sep 2012 04:42:59 -0400 Received: by wgbdr1 with SMTP id dr1so367652wgb.10 for ; Fri, 14 Sep 2012 01:42:58 -0700 (PDT) From: Stefan Hajnoczi Date: Fri, 14 Sep 2012 09:42:24 +0100 Message-Id: <1347612146-5407-11-git-send-email-stefanha@gmail.com> In-Reply-To: <1347612146-5407-1-git-send-email-stefanha@gmail.com> References: <1347612146-5407-1-git-send-email-stefanha@gmail.com> Subject: [Qemu-devel] [PATCH 10/12] kvm: Fix warning from static code analysis List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Stefan Weil , qemu-devel@nongnu.org, Stefan Hajnoczi From: Stefan Weil Report from smatch: kvm-all.c:1373 kvm_init(135) warn: variable dereferenced before check 's' (see line 1360) 's' cannot by NULL (it was alloced using g_malloc0), so there is no need to check it here. Signed-off-by: Stefan Weil Reviewed-by: Peter Maydell Signed-off-by: Stefan Hajnoczi --- kvm-all.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 39cff55..e5ed3df 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1409,13 +1409,11 @@ int kvm_init(void) return 0; err: - if (s) { - if (s->vmfd >= 0) { - close(s->vmfd); - } - if (s->fd != -1) { - close(s->fd); - } + if (s->vmfd >= 0) { + close(s->vmfd); + } + if (s->fd != -1) { + close(s->fd); } g_free(s); -- 1.7.10.4