From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:35732) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TddPn-0002Le-4k for qemu-devel@nongnu.org; Wed, 28 Nov 2012 03:54:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TddPj-0005kl-7V for qemu-devel@nongnu.org; Wed, 28 Nov 2012 03:54:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:65085) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TddPi-0005jY-WC for qemu-devel@nongnu.org; Wed, 28 Nov 2012 03:54:39 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qAS8sbP5010052 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 28 Nov 2012 03:54:37 -0500 From: Alon Levy Date: Wed, 28 Nov 2012 10:54:33 +0200 Message-Id: <1354092873-11954-1-git-send-email-alevy@redhat.com> Subject: [Qemu-devel] [PATCH] hw/qdev-monitor: report error for -device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, lcapitulino@redhat.com, armbru@redhat.com Instead of aborting immediately after at DEVICE_CLASS(obj) Signed-off-by: Alon Levy --- 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