From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:58971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1REJ97-0004bh-Sv for qemu-devel@nongnu.org; Thu, 13 Oct 2011 07:08:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1REJ95-0005Cc-Ot for qemu-devel@nongnu.org; Thu, 13 Oct 2011 07:08:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1025) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1REJ95-0005B1-Ec for qemu-devel@nongnu.org; Thu, 13 Oct 2011 07:08:15 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9DB8E4T003666 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 13 Oct 2011 07:08:14 -0400 From: Gerd Hoffmann Date: Thu, 13 Oct 2011 13:08:24 +0200 Message-Id: <1318504111-15309-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1318504111-15309-1-git-send-email-kraxel@redhat.com> References: <1318504111-15309-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 2/9] usb-hub: need to check dev->attached List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann 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 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/usb-hub.c b/hw/usb-hub.c index 286e3ad..39382c7 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; -- 1.7.1