From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NV1mH-0000O8-Jl for qemu-devel@nongnu.org; Wed, 13 Jan 2010 06:52:45 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NV1mD-0000MG-5r for qemu-devel@nongnu.org; Wed, 13 Jan 2010 06:52:45 -0500 Received: from [199.232.76.173] (port=35735 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NV1mD-0000MA-2L for qemu-devel@nongnu.org; Wed, 13 Jan 2010 06:52:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:30438) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NV1mC-0000Dj-K1 for qemu-devel@nongnu.org; Wed, 13 Jan 2010 06:52:40 -0500 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.13.8/8.13.8) with ESMTP id o0DBqdmG019436 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 13 Jan 2010 06:52:39 -0500 Date: Wed, 13 Jan 2010 17:21:32 +0530 From: Amit Shah Message-ID: <20100113115132.GB24002@amit-x200.redhat.com> References: <1263380087-31821-1-git-send-email-amit.shah@redhat.com> <1263380087-31821-2-git-send-email-amit.shah@redhat.com> <1263380087-31821-3-git-send-email-amit.shah@redhat.com> <1263380087-31821-4-git-send-email-amit.shah@redhat.com> <1263380087-31821-5-git-send-email-amit.shah@redhat.com> <1263380087-31821-6-git-send-email-amit.shah@redhat.com> <4B4DB28E.9070601@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4B4DB28E.9070601@redhat.com> Subject: [Qemu-devel] Re: [PATCH 5/6] qcow2-refcount: remove dead assignment List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On (Wed) Jan 13 2010 [12:46:22], Paolo Bonzini wrote: > On 01/13/2010 11:54 AM, Amit Shah wrote: >> clang-analyzer points out a redundant assignment. >> >> Signed-off-by: Amit Shah >> --- >> block/qcow2-refcount.c | 1 - >> 1 files changed, 0 insertions(+), 1 deletions(-) >> >> diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c >> index 54b19f8..3a2d44a 100644 >> --- a/block/qcow2-refcount.c >> +++ b/block/qcow2-refcount.c >> @@ -511,7 +511,6 @@ int qcow2_update_snapshot_refcount(BlockDriverState *bs, >> l2_table = NULL; >> l1_table = NULL; >> l1_size2 = l1_size * sizeof(uint64_t); >> - l1_allocated = 0; >> if (l1_table_offset != s->l1_table_offset) { >> if (l1_size2 != 0) { >> l1_table = qemu_mallocz(align_offset(l1_size2, 512)); > > I'd remove the l1_allocated = 0 assignment in the else branch instead > (the idea is, assign l1_allocated = 1 right after any qemu_malloc. I thought about that too, but since the else{} part has some other code, I decided to go that way. (Also that if such assignments aren't placed in common code, they'll be pointed out when someone tries to use them with the default undefined value.) Amit