qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] hw/core/qdev: Increase qdev_realize() kindness


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH] hw/core/qdev: Increase qdev_realize() kindness
Date: Sat, 4 Jul 2020 18:47:55 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

ping?

On 6/20/20 5:38 PM, Philippe Mathieu-Daudé wrote:
> Since commit 510ef98dca5, qdev_realize() aborts if bus-less
> device is realized on a bus. Be kind with the developer by
> displaying a hint about what is wrong.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/core/qdev.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 2131c7f951..dd3c90d37a 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -392,8 +392,11 @@ bool qdev_realize(DeviceState *dev, BusState *bus, Error 
> **errp)
>  
>      if (bus) {
>          qdev_set_parent_bus(dev, bus);
> -    } else {
> -        assert(!DEVICE_GET_CLASS(dev)->bus_type);
> +    } else if (DEVICE_GET_CLASS(dev)->bus_type) {
> +        error_report("%s: Unexpected bus '%s' for device '%s'",
> +                     __func__, DEVICE_GET_CLASS(dev)->bus_type,
> +                     object_get_typename(OBJECT(dev)));
> +        abort();
>      }
>  
>      object_property_set_bool(OBJECT(dev), true, "realized", &err);
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]