Patchwork [RFC,26/45] qemu-kvm: Use g_realloc for irq_routes extension

login
register
mail settings
Submitter Jan Kiszka
Date Oct. 17, 2011, 9:28 a.m.
Message ID <9b016ce56a88f464b37b6bd14fef659a39e7110d.1318843693.git.jan.kiszka@siemens.com>
Download mbox | patch
Permalink /patch/120174/
State New
Headers show

Comments

Jan Kiszka - Oct. 17, 2011, 9:28 a.m.
Allows to drop checking for out-of-memory.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 qemu-kvm.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

Patch

diff --git a/qemu-kvm.c b/qemu-kvm.c
index 6bdd7b5..eb8f176 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -258,7 +258,6 @@  int kvm_add_routing_entry(struct kvm_irq_routing_entry *entry,
 {
 #ifdef KVM_CAP_IRQ_ROUTING
     KVMState *s = kvm_state;
-    struct kvm_irq_routing *z;
     struct kvm_irq_routing_entry *new;
     int n, size;
 
@@ -269,12 +268,8 @@  int kvm_add_routing_entry(struct kvm_irq_routing_entry *entry,
         }
         size = sizeof(struct kvm_irq_routing);
         size += n * sizeof(*new);
-        z = realloc(s->irq_routes, size);
-        if (!z) {
-            return -ENOMEM;
-        }
+        s->irq_routes = g_realloc(s->irq_routes, size);
         s->nr_allocated_irq_routes = n;
-        s->irq_routes = z;
 
         s->msi_cache = g_realloc(s->msi_cache, sizeof(*s->msi_cache) * n);
     }