From: Amit Shah <amit.shah@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 5/6] qcow2-refcount: remove dead assignment
Date: Wed, 13 Jan 2010 17:21:32 +0530 [thread overview]
Message-ID: <20100113115132.GB24002@amit-x200.redhat.com> (raw)
In-Reply-To: <4B4DB28E.9070601@redhat.com>
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<amit.shah@redhat.com>
>> ---
>> 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
next prev parent reply other threads:[~2010-01-13 11:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-13 10:54 [Qemu-devel] [PATCH 0/6] Remove some dead assignments from clang analyzer report Amit Shah
2010-01-13 10:54 ` [Qemu-devel] [PATCH 1/6] vl.c: Remove dead assignment Amit Shah
2010-01-13 10:54 ` [Qemu-devel] [PATCH 2/6] virtio: net: remove " Amit Shah
2010-01-13 10:54 ` [Qemu-devel] [PATCH 3/6] x86: translate.c: " Amit Shah
2010-01-13 10:54 ` [Qemu-devel] [PATCH 4/6] hw/vga.c: " Amit Shah
2010-01-13 10:54 ` [Qemu-devel] [PATCH 5/6] qcow2-refcount: " Amit Shah
2010-01-13 10:54 ` [Qemu-devel] [PATCH 6/6] json-parser: remove dead increment Amit Shah
2010-01-13 11:46 ` [Qemu-devel] Re: [PATCH 5/6] qcow2-refcount: remove dead assignment Paolo Bonzini
2010-01-13 11:51 ` Amit Shah [this message]
2010-01-13 20:51 ` [Qemu-devel] Re: [PATCH 2/6] virtio: net: " Michael S. Tsirkin
2010-01-13 23:27 ` [Qemu-devel] [PATCH 1/6] vl.c: Remove " Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100113115132.GB24002@amit-x200.redhat.com \
--to=amit.shah@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).