[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 24/84] qdev: Assert devices are plugged into a bus that can take t
From: |
Markus Armbruster |
Subject: |
[PULL 24/84] qdev: Assert devices are plugged into a bus that can take them |
Date: |
Mon, 15 Jun 2020 22:39:08 +0200 |
This would have caught some of the bugs I just fixed.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20200609122339.937862-23-armbru@redhat.com>
---
hw/core/qdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 9e5538aeae..b5b42b2616 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -97,6 +97,9 @@ static void bus_add_child(BusState *bus, DeviceState *child)
void qdev_set_parent_bus(DeviceState *dev, BusState *bus)
{
BusState *old_parent_bus = dev->parent_bus;
+ DeviceClass *dc = DEVICE_GET_CLASS(dev);
+
+ assert(dc->bus_type && object_dynamic_cast(OBJECT(bus), dc->bus_type));
if (old_parent_bus) {
trace_qdev_update_parent_bus(dev, object_get_typename(OBJECT(dev)),
--
2.26.2
- [PULL 00/84] QOM patches for 2020-06-15, Markus Armbruster, 2020/06/15
- [PULL 02/84] qom: Make "info qom-tree" show children sorted, Markus Armbruster, 2020/06/15
- [PULL 06/84] arm/aspeed: Compute the number of CPUs from the SoC definition, Markus Armbruster, 2020/06/15
- [PULL 04/84] display/xlnx_dp: Fix to realize "i2c-ddc" and "aux-to-i2c-bridge", Markus Armbruster, 2020/06/15
- [PULL 07/84] arm/aspeed: Rework NIC attachment, Markus Armbruster, 2020/06/15
- [PULL 05/84] sd/pxa2xx_mmci: Fix to realize "pxa2xx-mmci" device, Markus Armbruster, 2020/06/15
- [PULL 16/84] macio: Put "macio-nvram" device on the macio bus, Markus Armbruster, 2020/06/15
- [PULL 10/84] mac_via: Fix to realize "mos6522-q800-via*" devices, Markus Armbruster, 2020/06/15
- [PULL 09/84] auxbus: Fix aux-to-i2c-bridge to be a subtype of aux-slave, Markus Armbruster, 2020/06/15
- [PULL 24/84] qdev: Assert devices are plugged into a bus that can take them,
Markus Armbruster <=
- [PULL 22/84] riscv: Fix type of SiFive[EU]SocState, member parent_obj, Markus Armbruster, 2020/06/15
- [PULL 19/84] pnv/psi: Correct the pnv-psi* devices not to be sysbus devices, Markus Armbruster, 2020/06/15
- [PULL 27/84] qdev: Rename qbus_realize() to qbus_init(), Markus Armbruster, 2020/06/15
- [PULL 11/84] macio: Fix to realize "mos6522-cuda" and "mos6522-pmu" devices, Markus Armbruster, 2020/06/15
- [PULL 15/84] ppc4xx: Drop redundant device realization, Markus Armbruster, 2020/06/15
- [PULL 14/84] MAINTAINERS: Make section PowerNV cover pci-host/pnv* as well, Markus Armbruster, 2020/06/15
- [PULL 17/84] macio: Fix macio-bus to be a subtype of System bus, Markus Armbruster, 2020/06/15
- [PULL 31/84] qdev: Put qdev_new() to use with Coccinelle, Markus Armbruster, 2020/06/15
- [PULL 08/84] armv7m: Delete unused "ARM,bitband-memory" devices, Markus Armbruster, 2020/06/15
- [PULL 35/84] qdev: Convert uses of qdev_create() with Coccinelle, Markus Armbruster, 2020/06/15