From: Gonglei <arei.gong...@huawei.com> When hot-unplugging the usb controllers (ehci/uhci), we have to clean all resouce of these devices, involved registered reset handler. Otherwise, it may cause NULL pointer access and/or segmentation fault if we reboot the guest os after hot-unplugging. Let's hook up reset via DeviceClass->reset() and drop the qemu_register_reset() call. Then Qemu will register and unregister the reset handler automatically.
Cc: qemu-stable <qemu-sta...@nongnu.org> v1 -> v2: - hooking up reset via DeviceClass->reset and drop the qemu_register_reset() calls. (Gerd) Gonglei (3): uhci: using DeviceClasss->reset qemu_register_reset() call ehci: using DeviceClasss->reset qemu_register_reset() call ohci: using DeviceClasss->reset qemu_register_reset() call hw/usb/hcd-ehci-pci.c | 10 ++++++++++ hw/usb/hcd-ehci.c | 3 +-- hw/usb/hcd-ehci.h | 1 + hw/usb/hcd-ohci.c | 11 ++++++++++- hw/usb/hcd-uhci.c | 12 ++++++------ 5 files changed, 28 insertions(+), 9 deletions(-) -- 1.7.12.4