lkml.org 
[lkml]   [2010]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] KVM: remove unused code in kvm_coalesced_mmio_init()
On 04/12/2010 12:34 PM, wzt.wzt@gmail.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.



\
 
 \ /
  Last update: 2010-04-12 18:13    [W:0.045 / U:1.448 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site