Avi Kivity wrote: > Han, Weidong wrote: >> >> -int pci_unregister_device(PCIDevice *pci_dev) >> +int pci_unregister_device(PCIDevice *pci_dev, int assigned) { >> int ret = 0; >> >> @@ -377,7 +377,11 @@ int pci_unregister_device(PCIDevice *pci_dev) >> qemu_free_irqs(pci_dev->irq); >> pci_irq_index--; >> pci_dev->bus->devices[pci_dev->devfn] = NULL; >> - qdev_free(&pci_dev->qdev); >> + >> + if (assigned) >> + qemu_free(pci_dev); >> + else >> + qdev_free(&pci_dev->qdev); >> return 0; >> } >> > > Can you check pci_dev->qdev instead of assigned? A little less ugly. I tried to find an easy and clean way to check it, but I found the members of struct PCIDevice and DeviceState were not suitable for this checking, and qdev is not pointer in struct PCIDevice. Regards, Weidong-- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html