[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 22/24] qdev: Assert devices are plugged into a bus that can ta
From: |
Markus Armbruster |
Subject: |
[PATCH v2 22/24] qdev: Assert devices are plugged into a bus that can take them |
Date: |
Thu, 28 May 2020 13:04:42 +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>
---
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.21.3
- [PATCH v2 12/24] MAINTAINERS: Make section PowerNV cover pci-host/pnv* as well, (continued)
- [PATCH v2 12/24] MAINTAINERS: Make section PowerNV cover pci-host/pnv* as well, Markus Armbruster, 2020/05/28
- [PATCH v2 08/24] mac_via: Fix to realize "mos6522-q800-via*" devices, Markus Armbruster, 2020/05/28
- [PATCH v2 13/24] ppc4xx: Drop redundant device realization, Markus Armbruster, 2020/05/28
- [PATCH v2 14/24] macio: Put "macio-nvram" device on the macio bus, Markus Armbruster, 2020/05/28
- [PATCH v2 18/24] display/sm501 display/ati: Fix to realize "i2c-ddc", Markus Armbruster, 2020/05/28
- [PATCH v2 11/24] pnv/phb4: Delete unused "pnv-phb4-pec-stack" devices, Markus Armbruster, 2020/05/28
- [PATCH v2 05/24] arm/aspeed: Rework NIC attachment, Markus Armbruster, 2020/05/28
- [PATCH v2 03/24] sd/pxa2xx_mmci: Fix to realize "pxa2xx-mmci" device, Markus Armbruster, 2020/05/28
- [PATCH v2 07/24] auxbus: Fix aux-to-i2c-bridge to be a subtype of aux-slave, Markus Armbruster, 2020/05/28
- [PATCH v2 22/24] qdev: Assert devices are plugged into a bus that can take them,
Markus Armbruster <=
- [PATCH v2 17/24] pnv/psi: Correct the pnv-psi* devices not to be sysbus devices, Markus Armbruster, 2020/05/28
- [PATCH v2 09/24] macio: Fix to realize "mos6522-cuda" and "mos6522-pmu" devices, Markus Armbruster, 2020/05/28
- [PATCH v2 23/24] sd: Hide the qdev-but-not-quite thing created by sd_init(), Markus Armbruster, 2020/05/28
- [PATCH v2 20/24] riscv: Fix type of SiFive[EU]SocState, member parent_obj, Markus Armbruster, 2020/05/28
- [PATCH v2 04/24] arm/aspeed: Compute the number of CPUs from the SoC definition, Markus Armbruster, 2020/05/28
- [PATCH v2 15/24] macio: Fix macio-bus to be a subtype of System bus, Markus Armbruster, 2020/05/28
- [PATCH v2 16/24] ppc/pnv: Put "*-pnv-chip" and "pnv-xive" on the main system bus, Markus Armbruster, 2020/05/28
- [PATCH v2 24/24] qdev: Assert onboard devices all get realized properly, Markus Armbruster, 2020/05/28
- [PATCH v2 10/24] macio: Delete unused "macio-gpio" devices, Markus Armbruster, 2020/05/28
- [PATCH v2 21/24] sparc/leon3: Fix to put grlib,* devices on sysbus, Markus Armbruster, 2020/05/28