Hi, > +void usb_bus_release(USBBus *bus) > +{ > + assert(next_usb_bus > 0); > + > + next_usb_bus--; > + QTAILQ_REMOVE(&busses, bus, next); > +}
That breaks when not hotplugging in last-in-first-out order. I'd suggest to simply leave next_usb_bus alone on unplug. It is only used for bus numbering. We'll get holes in our bus numbering then, but we can't avoid that with hotplug anyway. cheers, Gerd