aboutsummaryrefslogtreecommitdiff
path: root/hw/usb-hub.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2011-09-15 09:20:02 +0200
committerGerd Hoffmann <kraxel@redhat.com>2011-10-13 12:58:51 +0200
commit3393bc105d58e1f4a27d9a8e7062da9cef260cc3 (patch)
treefaeada2e292018334aefe97f64a341719c003d98 /hw/usb-hub.c
parentd3ac1a87b228bcd231d19acf1ebe9844b7639237 (diff)
usb-hub: need to check dev->attached
commit 891fb2cd4592b6fe76106a69e0ca40efbf82726a did that for all host controllers, the usb hub was left out by accident. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb-hub.c')
-rw-r--r--hw/usb-hub.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/usb-hub.c b/hw/usb-hub.c
index 286e3ad85d..39382c7386 100644
--- a/hw/usb-hub.c
+++ b/hw/usb-hub.c
@@ -289,7 +289,7 @@ static int usb_hub_handle_control(USBDevice *dev, USBPacket *p,
port->wPortStatus |= PORT_STAT_SUSPEND;
break;
case PORT_RESET:
- if (dev) {
+ if (dev && dev->attached) {
usb_send_msg(dev, USB_MSG_RESET);
port->wPortChange |= PORT_STAT_C_RESET;
/* set enable bit */
@@ -429,7 +429,7 @@ static int usb_hub_broadcast_packet(USBHubState *s, USBPacket *p)
for(i = 0; i < NUM_PORTS; i++) {
port = &s->ports[i];
dev = port->port.dev;
- if (dev && (port->wPortStatus & PORT_STAT_ENABLE)) {
+ if (dev && dev->attached && (port->wPortStatus & PORT_STAT_ENABLE)) {
ret = usb_handle_packet(dev, p);
if (ret != USB_RET_NODEV) {
return ret;