From: Paolo Bonzini <pbonzini@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>, qemu-devel@nongnu.org
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>
Subject: Re: [PATCH v3] hw/core/qdev: Increase qdev_realize() kindness
Date: Tue, 7 Jul 2020 11:47:25 +0200 [thread overview]
Message-ID: <4e472f6a-e6b3-910b-97fe-0526d1f560a1@redhat.com> (raw)
In-Reply-To: <20200707033326.19178-1-f4bug@amsat.org>
On 07/07/20 05:33, Philippe Mathieu-Daudé wrote:
> Since commit 510ef98dca5, qdev_realize() aborts if bus-less device
> is realized on a bus. While commits 514db7710b..007d1dbf72 took
> care of converting all mainstream uses, QEMU forks weren't. These
> forks are usually maintained by hobbyist with interest in following
> mainstream development, but with limited time, so usually rebase
> from time to time. To avoid them to spend time on debugging and
> reading git-log history, display a kind hint about what is wrong.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> Since v2:
> - scratch __func__ (armbru)
> - reword to justify this is not an impossible case (armbru)
> ---
> 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..a16f1270f1 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_setg(errp, "Unexpected bus '%s' for bus-less device '%s'",
> + DEVICE_GET_CLASS(dev)->bus_type,
> + object_get_typename(OBJECT(dev)));
> + return false;
> }
>
> object_property_set_bool(OBJECT(dev), true, "realized", &err);
>
Queued, thanks.
Paolo
next prev parent reply other threads:[~2020-07-07 9:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-07 3:33 [PATCH v3] hw/core/qdev: Increase qdev_realize() kindness Philippe Mathieu-Daudé
2020-07-07 3:36 ` Philippe Mathieu-Daudé
2020-07-07 9:47 ` Paolo Bonzini [this message]
2020-07-27 17:55 ` Philippe Mathieu-Daudé
2020-07-28 7:46 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4e472f6a-e6b3-910b-97fe-0526d1f560a1@redhat.com \
--to=pbonzini@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=ehabkost@redhat.com \
--cc=f4bug@amsat.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).