diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index b7512a71dcd849ae84a1c08700fd37c0684cd21d..16b990d9cc714e7b30366b98b6bed85529abe894 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1515,9 +1515,9 @@ cleanup: virSecurityManagerRestoreHostdevLabel(driver->securityManager, vm->def, hostdev, NULL) < 0) VIR_WARN("Unable to restore host device labelling on hotplug fail"); + if (added) + virUSBDeviceListSteal(driver->activeUsbHostdevs, usb); } - if (added) - virUSBDeviceListSteal(driver->activeUsbHostdevs, usb); if (list && usb && !virUSBDeviceListFind(list, usb) && !virUSBDeviceListFind(driver->activeUsbHostdevs, usb))