aboutsummaryrefslogtreecommitdiffstats
path: root/hw/usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/usb.c')
-rw-r--r--hw/usb.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/hw/usb.c b/hw/usb.c
index 735ffd196..27a983ca5 100644
--- a/hw/usb.c
+++ b/hw/usb.c
@@ -40,12 +40,11 @@ void usb_attach(USBPort *port, USBDevice *dev)
} else {
/* detach */
dev = port->dev;
+ assert(dev);
port->ops->detach(port);
- if (dev) {
- usb_send_msg(dev, USB_MSG_DETACH);
- dev->port = NULL;
- port->dev = NULL;
- }
+ usb_send_msg(dev, USB_MSG_DETACH);
+ dev->port = NULL;
+ port->dev = NULL;
}
}