From patchwork Wed Feb 24 17:55:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 46153 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D628CB7CBB for ; Thu, 25 Feb 2010 05:08:17 +1100 (EST) Received: from localhost ([127.0.0.1]:47595 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NkLeh-0002hR-2e for incoming@patchwork.ozlabs.org; Wed, 24 Feb 2010 13:08:15 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NkLTC-0007xu-1h for qemu-devel@nongnu.org; Wed, 24 Feb 2010 12:56:22 -0500 Received: from [199.232.76.173] (port=59147 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NkLTB-0007xS-6z for qemu-devel@nongnu.org; Wed, 24 Feb 2010 12:56:21 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NkLT0-0006R7-8i for qemu-devel@nongnu.org; Wed, 24 Feb 2010 12:56:20 -0500 Received: from oxygen.pond.sub.org ([213.239.205.148]:37611) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NkLSz-0006Q8-40 for qemu-devel@nongnu.org; Wed, 24 Feb 2010 12:56:09 -0500 Received: from blackfin.pond.sub.org (pD9E38C12.dip.t-dialin.net [217.227.140.18]) by oxygen.pond.sub.org (Postfix) with ESMTPA id B64A23127A9 for ; Wed, 24 Feb 2010 18:56:04 +0100 (CET) Received: by blackfin.pond.sub.org (Postfix, from userid 500) id ED91A10A; Wed, 24 Feb 2010 18:56:01 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 24 Feb 2010 18:55:34 +0100 Message-Id: <1267034160-3517-23-git-send-email-armbru@redhat.com> X-Mailer: git-send-email 1.6.6 In-Reply-To: <1267034160-3517-1-git-send-email-armbru@redhat.com> References: <1267034160-3517-1-git-send-email-armbru@redhat.com> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: [Qemu-devel] [PATCH RFC 22/48] qdev: Fix -device and device_add to handle unsuitable bus gracefully X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org "device_add isa-serial,bus=pci.0" kills QEMU. Not good. Signed-off-by: Markus Armbruster --- hw/qdev.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index 38fc4e7..7def97d 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -204,6 +204,11 @@ DeviceState *qdev_device_add(QemuOpts *opts) path = qemu_opt_get(opts, "bus"); if (path != NULL) { bus = qbus_find(path); + if (bus && bus->info != info->bus_info) { + qemu_error("Device '%s' can't go on a %s bus", + driver, bus->info->name); + return NULL; + } } else { bus = qbus_find_recursive(main_system_bus, NULL, info->bus_info); }