[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4BC345CE.9070501@redhat.com>
Date: Mon, 12 Apr 2010 19:09:50 +0300
From: Avi Kivity <avi@...hat.com>
To: wzt.wzt@...il.com
CC: linux-kernel@...r.kernel.org, mtosatti@...hat.com,
kvm@...r.kernel.org
Subject: Re: [PATCH] KVM: remove unused code in kvm_coalesced_mmio_init()
On 04/12/2010 12:34 PM, wzt.wzt@...il.com wrote:
> ret is already set as ENOMEM before, so the second ret = -ENOMEM; can be removed.
>
>
> diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c
> index 5169736..c0dcfb7 100644
> --- a/virt/kvm/coalesced_mmio.c
> +++ b/virt/kvm/coalesced_mmio.c
> @@ -101,7 +101,6 @@ int kvm_coalesced_mmio_init(struct kvm *kvm)
> goto out_err;
> kvm->coalesced_mmio_ring = page_address(page);
>
> - ret = -ENOMEM;
> dev = kzalloc(sizeof(struct kvm_coalesced_mmio_dev), GFP_KERNEL);
> if (!dev)
> goto out_free_page;
>
I prefer to keep it there and let the compiler do the elimination.
Otherwise inserting any code in the middle may cause a bug (the
assignment is logically part of the code block, it only matches the
previous one by accident).
--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists