void qdev_free(DeviceState *dev)

{

    BusState *bus;




    if (dev->state == DEV_STATE_INITIALIZED) {

        while (dev->num_child_bus) {

            bus = QLIST_FIRST(&dev->child_bus);

            qbus_free(bus);

        }

        if (dev->info->vmsd)

            vmstate_unregister(dev->info->vmsd, dev);

        if (dev->info->exit)

            dev->info->exit(dev);

        if (dev->opts)

            qemu_opts_del(dev->opts);

    }

    qemu_unregister_reset(qdev_reset, dev);

    QLIST_REMOVE(dev, sibling);

    for (prop = dev->info->props; prop && prop->name; prop++) {

        if (prop->info->free) {

            prop->info->free(dev, prop);

        }

    }

    qemu_free(dev);

}
void qdev_free(DeviceState *dev)

{

    BusState *bus;




    if (dev->state == DEV_STATE_INITIALIZED) {

        while (dev->num_child_bus) {

            bus = QLIST_FIRST(&dev->child_bus);

            qbus_free(bus);

        }

        if (dev->info->vmsd)

            vmstate_unregister(dev->info->vmsd, dev);

        if (dev->info->exit)

            dev->info->exit(dev);

        if (dev->opts)

            qemu_opts_del(dev->opts);

    }

    qemu_unregister_reset(qdev_reset, dev);

    QLIST_REMOVE(dev, sibling);

    for (prop = dev->info->props; prop && prop->name; prop++) {

        if (prop->info->free) {

            prop->info->free(dev, prop);

        }

    }

    qemu_free(dev);

}
void FUNC_0(DeviceState *VAR_0)

{

    BusState *bus;




    if (VAR_0->state == DEV_STATE_INITIALIZED) {

        while (VAR_0->num_child_bus) {

            bus = QLIST_FIRST(&VAR_0->child_bus);

            qbus_free(bus);

        }

        if (VAR_0->info->vmsd)

            vmstate_unregister(VAR_0->info->vmsd, VAR_0);

        if (VAR_0->info->exit)

            VAR_0->info->exit(VAR_0);

        if (VAR_0->opts)

            qemu_opts_del(VAR_0->opts);

    }

    qemu_unregister_reset(qdev_reset, VAR_0);

    QLIST_REMOVE(VAR_0, sibling);

    for (prop = VAR_0->info->props; prop && prop->name; prop++) {

        if (prop->info->free) {

            prop->info->free(VAR_0, prop);

        }

    }

    qemu_free(VAR_0);

}
void FUNC_0(DeviceState *VAR_0)
{ BusState *bus; if (VAR_0->state == DEV_STATE_INITIALIZED) { while (VAR_0->num_child_bus) { bus = QLIST_FIRST(&VAR_0->child_bus); qbus_free(bus); } if (VAR_0->info->vmsd)
vmstate_unregister(VAR_0->info->vmsd, VAR_0); if (VAR_0->info->exit)
VAR_0->info->exit(VAR_0); if (VAR_0->opts)
qemu_opts_del(VAR_0->opts); } qemu_unregister_reset(qdev_reset, VAR_0); QLIST_REMOVE(VAR_0, sibling); for (prop = VAR_0->info->props; prop && prop->name; prop++) { if (prop->info->free) { prop->info->free(VAR_0, prop); } } qemu_free(VAR_0); }