[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 22/24] qdev: Assert devices are plugged into a bus that can t
From: |
Markus Armbruster |
Subject: |
Re: [PATCH 22/24] qdev: Assert devices are plugged into a bus that can take them |
Date: |
Mon, 18 May 2020 17:03:35 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Markus Armbruster <address@hidden> writes:
> This would have caught some of the bugs I just fixed.
>
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> hw/core/qdev.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 9e5538aeae..0df995eb94 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -97,6 +97,11 @@ 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
> + ? bus && object_dynamic_cast(OBJECT(bus), dc->bus_type)
> + : !bus);
>
> if (old_parent_bus) {
> trace_qdev_update_parent_bus(dev, object_get_typename(OBJECT(dev)),
Actually, !bus crashes below in bus_add_child(). Simpler assertion:
assert(dc->bus_type && object_dynamic_cast(OBJECT(bus), dc->bus_type));
- [PATCH 10/24] macio: Bury unwanted "macio-gpio" devices, (continued)
- [PATCH 10/24] macio: Bury unwanted "macio-gpio" devices, Markus Armbruster, 2020/05/18
- [PATCH 16/24] ppc/pnv: Put "*-pnv-chip" and "pnv-xive" on the main system bus, Markus Armbruster, 2020/05/18
- [PATCH 24/24] qdev: Assert onboard devices all get realized properly, Markus Armbruster, 2020/05/18
- [PATCH 22/24] qdev: Assert devices are plugged into a bus that can take them, Markus Armbruster, 2020/05/18
- [PATCH 06/24] armv7m: Bury unwanted "ARM,bitband-memory" devices, Markus Armbruster, 2020/05/18
- Re: [PATCH 06/24] armv7m: Bury unwanted "ARM,bitband-memory" devices, Peter Maydell, 2020/05/21
- Re: [PATCH 06/24] armv7m: Bury unwanted "ARM,bitband-memory" devices, Markus Armbruster, 2020/05/25
- Re: [PATCH 06/24] armv7m: Bury unwanted "ARM,bitband-memory" devices, Paolo Bonzini, 2020/05/25
- Re: [PATCH 06/24] armv7m: Bury unwanted "ARM,bitband-memory" devices, Peter Maydell, 2020/05/25
- Re: [PATCH 06/24] armv7m: Bury unwanted "ARM,bitband-memory" devices, Markus Armbruster, 2020/05/26
[PATCH 18/24] display/sm501 display/ati: Fix to realize "i2c-ddc", Markus Armbruster, 2020/05/18