From: Gerd Hoffmann Date: Thu, 15 Sep 2011 07:20:02 +0000 (+0200) Subject: usb-hub: need to check dev->attached X-Git-Tag: v1.0-rc0~129^2~7 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=3393bc105d58e1f4a27d9a8e7062da9cef260cc3;p=qemu.git 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 --- diff --git a/hw/usb-hub.c b/hw/usb-hub.c index 286e3ad85..39382c738 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;