aboutsummaryrefslogtreecommitdiff
path: root/hw/usb/dev-storage.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/usb/dev-storage.c')
-rw-r--r--hw/usb/dev-storage.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
index 55ef6848a7..9cd405c1c1 100644
--- a/hw/usb/dev-storage.c
+++ b/hw/usb/dev-storage.c
@@ -549,12 +549,17 @@ static void usb_msd_handle_data(USBDevice *dev, USBPacket *p)
static void usb_msd_password_cb(void *opaque, int err)
{
MSDState *s = opaque;
+ Error *local_err = NULL;
- if (!err)
- err = usb_device_attach(&s->dev);
+ if (!err) {
+ usb_device_attach(&s->dev, &local_err);
+ }
- if (err)
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
qdev_unplug(&s->dev.qdev, NULL);
+ }
}
static void *usb_msd_load_request(QEMUFile *f, SCSIRequest *req)