aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
Diffstat (limited to 'hw')
-rw-r--r--hw/usb/bus.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index b375293..da1eba9 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -478,7 +478,7 @@ static void usb_mask_to_str(char *dest, size_t size,
}
}
-void usb_device_attach(USBDevice *dev, Error **errp)
+void usb_check_attach(USBDevice *dev, Error **errp)
{
USBBus *bus = usb_bus_from_device(dev);
USBPort *port = dev->port;
@@ -499,6 +499,18 @@ void usb_device_attach(USBDevice *dev, Error **errp)
bus->qbus.name, port->path, portspeed);
return;
}
+}
+
+void usb_device_attach(USBDevice *dev, Error **errp)
+{
+ USBPort *port = dev->port;
+ Error *local_err = NULL;
+
+ usb_check_attach(dev, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
+ }
dev->attached++;
usb_attach(port);