From: "Andreas Färber" <afaerber@suse.de>
To: Jun Li <junmuzi@gmail.com>, qemu-devel@nongnu.org
Cc: peter.crosthwaite@xilinx.com, famz@redhat.com, mst@redhat.com,
juli@redhat.com, imammedo@redhat.com, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3] qdev: Avoid type assertion in qdev_build_hotpluggable_device_list()
Date: Tue, 09 Dec 2014 16:29:02 +0100 [thread overview]
Message-ID: <5487153E.70002@suse.de> (raw)
In-Reply-To: <1415170983-12981-1-git-send-email-junmuzi@gmail.com>
Am 05.11.2014 um 08:03 schrieb Jun Li:
> Currently when *obj is not a TYPE_DEVICE, qemu will abort. This patch just
> fixed it. When *obj is not a TYPE_DEVICE, just do not add it to hotpluggable
> device list.
>
> This patch also fixed the following issue:
> 1, boot qemu using cli:
> $ /opt/qemu-git-arm/bin/qemu-system-x86_64 -monitor stdio -enable-kvm \
> -device virtio-scsi-pci,id=scsi0
>
> 2, device_del scsi0 via hmp using tab key(first input device_del, then press
> "Tab" key).
> (qemu) device_del
>
> After step2, qemu will abort.
> (qemu) device_del hw/core/qdev.c:930:qdev_build_hotpluggable_device_list:
> Object 0x5555563a2460 is not an instance of type device
>
> Signed-off-by: Jun Li <junmuzi@gmail.com>
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> v3:
> According to Andreas's suggestion, do some changes. As followings:
> 1, change the Subject to more meaningful.
> 2, use two "return 0" to return early avoid reindentation. And I have found in qcow2_grow_l1_table has also used two "return 0". So accept Andreas's suggestion. Thanks.
Thanks, replaced the queued version on qom-next with a few edits and the
following change:
https://github.com/afaerber/qemu-cpu/commits/qom-next
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 51ab59e..ef06aa4 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -939,7 +939,7 @@ static int qdev_add_hotpluggable_device(Object *obj,
void *opaque)
{
GSList **list = opaque;
DeviceState *dev = (DeviceState *)object_dynamic_cast(OBJECT(obj),
- "device");
+ TYPE_DEVICE);
if (dev == NULL) {
return 0;
Regards,
Andreas
--
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 21284 AG Nürnberg
prev parent reply other threads:[~2014-12-09 15:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-05 7:03 [Qemu-devel] [PATCH v3] qdev: Avoid type assertion in qdev_build_hotpluggable_device_list() Jun Li
2014-12-08 14:07 ` Jun Li
2014-12-09 15:08 ` Andreas Färber
2014-12-09 15:29 ` Andreas Färber [this message]
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=5487153E.70002@suse.de \
--to=afaerber@suse.de \
--cc=famz@redhat.com \
--cc=imammedo@redhat.com \
--cc=juli@redhat.com \
--cc=junmuzi@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.crosthwaite@xilinx.com \
--cc=qemu-devel@nongnu.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).