qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] hw/qdev-monitor: report error for -device <not-a-de


From: Alon Levy
Subject: [Qemu-devel] [PATCH] hw/qdev-monitor: report error for -device <not-a-device-type>
Date: Wed, 28 Nov 2012 10:54:33 +0200

Instead of aborting immediately after at DEVICE_CLASS(obj)

Signed-off-by: Alon Levy <address@hidden>
---
 hw/qdev-monitor.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/qdev-monitor.c b/hw/qdev-monitor.c
index 479eecd..3b70cdb 100644
--- a/hw/qdev-monitor.c
+++ b/hw/qdev-monitor.c
@@ -426,6 +426,11 @@ DeviceState *qdev_device_add(QemuOpts *opts)
         return NULL;
     }
 
+    if (!object_class_dynamic_cast(obj, "device")) {
+        qerror_report(QERR_INVALID_PARAMETER_TYPE, "driver", "device type");
+        return NULL;
+    }
+
     k = DEVICE_CLASS(obj);
 
     /* find bus */
-- 
1.8.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]