usb-hub: need to check dev->attached

commit 891fb2cd45 did that for all host
controllers, the usb hub was left out by accident.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Gerd Hoffmann 2011-09-15 09:20:02 +02:00
parent d3ac1a87b2
commit 3393bc105d

View file

@ -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;