Skip to contentSkip to conversation

KVM: remove unused code in kvm_coalesced_mmio_init()

PATCH In review [email protected] 2 participants 2 messages Apr 12, 2010 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: remove unused code in kvm_coalesced_mmio_init()

ret is already set as ENOMEM before, so the second ret = -ENOMEM; can be removed.

---
 virt/kvm/coalesced_mmio.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
virt/kvm/coalesced_mmio.c +0 -1
index 5169736..c0dcfb7 100644
@@ -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;
Signature · 1 line
1.6.5.3
#1 lore raw
Quoted 9 lines · On 04/12/2010 12:34 PM, [email protected] wrote:

ret is already set as ENOMEM before, so the second ret = -ENOMEM; can be removed.

virt/kvm/coalesced_mmio.c +0 -0
index 5169736..c0dcfb7 100644

virt/kvm/coalesced_mmio.c int kvm_coalesced_mmio_init(struct kvm *kvm) · line 106

Quoted 7 lines
virt/kvm/coalesced_mmio.c +0 -1
@@ -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).

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.