Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
hw/i386/microvm: Simplify using object_dynamic_cast()
Use object_dynamic_cast() to determine if 'dev' is a TYPE_VIRTIO_MMIO.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Sergio Lopez <slp@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
philmd authored and Michael Tokarev committed Jun 9, 2023
1 parent f2def09 commit 3d455fc
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions hw/i386/microvm.c
Expand Up @@ -389,9 +389,8 @@ static void microvm_fix_kernel_cmdline(MachineState *machine)
bus = sysbus_get_default();
QTAILQ_FOREACH(kid, &bus->children, sibling) {
DeviceState *dev = kid->child;
ObjectClass *class = object_get_class(OBJECT(dev));

if (class == object_class_by_name(TYPE_VIRTIO_MMIO)) {
if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MMIO)) {
VirtIOMMIOProxy *mmio = VIRTIO_MMIO(OBJECT(dev));
VirtioBusState *mmio_virtio_bus = &mmio->bus;
BusState *mmio_bus = &mmio_virtio_bus->parent_obj;
Expand Down

0 comments on commit 3d455fc

Please sign in to comment.