From 3393bc105d58e1f4a27d9a8e7062da9cef260cc3 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 15 Sep 2011 09:20:02 +0200 Subject: [PATCH] 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 --- hw/usb-hub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; -- 2.39.5