From patchwork Wed Nov 28 08:54:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 202388 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 877182C0081 for ; Wed, 28 Nov 2012 19:54:57 +1100 (EST) Received: from localhost ([::1]:58121 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TddPz-0002M4-6f for incoming@patchwork.ozlabs.org; Wed, 28 Nov 2012 03:54:55 -0500 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 Received: from garlic.redhat.com (vpn1-4-144.ams2.redhat.com [10.36.4.144]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qAS8sYP6008748; Wed, 28 Nov 2012 03:54:34 -0500 From: Alon Levy To: qemu-devel@nongnu.org, lcapitulino@redhat.com, armbru@redhat.com Date: Wed, 28 Nov 2012 10:54:33 +0200 Message-Id: <1354092873-11954-1-git-send-email-alevy@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] hw/qdev-monitor: report error for -device X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 */