* [PATCH] KVM: remove unused code in kvm_coalesced_mmio_init()
@ 2010-04-12 9:34 wzt.wzt
2010-04-12 16:09 ` Avi Kivity
0 siblings, 1 reply; 2+ messages in thread
From: wzt.wzt @ 2010-04-12 9:34 UTC (permalink / raw)
To: linux-kernel; +Cc: avi, mtosatti, kvm
ret is already set as ENOMEM before, so the second ret = -ENOMEM; can be removed.
Signed-off-by: Zhitong Wang <zhitong.wangzt@alibaba-inc.com>
---
virt/kvm/coalesced_mmio.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
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;
--
1.6.5.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] KVM: remove unused code in kvm_coalesced_mmio_init()
2010-04-12 9:34 [PATCH] KVM: remove unused code in kvm_coalesced_mmio_init() wzt.wzt
@ 2010-04-12 16:09 ` Avi Kivity
0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2010-04-12 16:09 UTC (permalink / raw)
To: wzt.wzt; +Cc: linux-kernel, mtosatti, kvm
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-04-12 16:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-12 9:34 [PATCH] KVM: remove unused code in kvm_coalesced_mmio_init() wzt.wzt
2010-04-12 16:09 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox