diff mbox

[10/11] fixup! pc: explicitly check maxmem limit when adding DIMM

Message ID 1415283373-30765-1-git-send-email-imammedo@redhat.com
State New
Headers show

Commit Message

Igor Mammedov Nov. 6, 2014, 2:16 p.m. UTC
Fix build failure that would be caused by missing pc_dimm_count()
that was introduced in dropped
  [03/11] pc: check if KVM has enough memory slots for DIMM devices

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/pc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff mbox

Patch

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 1d413a7..e656658 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1550,6 +1550,18 @@  void qemu_register_pc_machine(QEMUMachine *m)
     g_free(name);
 }
 
+static int pc_dimm_count(Object *obj, void *opaque)
+{
+    int *count = opaque;
+
+    if (object_dynamic_cast(obj, TYPE_PC_DIMM)) {
+        (*count)++;
+    }
+
+    object_child_foreach(obj, pc_dimm_count, opaque);
+    return 0;
+}
+
 static int pc_existing_dimms_capacity(Object *obj, void *opaque)
 {
     Error *local_err = NULL;