From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:34035) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHeD9-0008CY-77 for qemu-devel@nongnu.org; Wed, 04 May 2011 11:42:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QHeD8-0007J1-6m for qemu-devel@nongnu.org; Wed, 04 May 2011 11:41:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44367) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHeD7-0007Ih-QD for qemu-devel@nongnu.org; Wed, 04 May 2011 11:41:58 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p44FfuuT031759 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 4 May 2011 11:41:57 -0400 From: Gerd Hoffmann Date: Wed, 4 May 2011 17:41:40 +0200 Message-Id: <1304523708-9556-7-git-send-email-kraxel@redhat.com> In-Reply-To: <1304523708-9556-1-git-send-email-kraxel@redhat.com> References: <1304523708-9556-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 06/14] usb-linux: We only need to keep track of 15 endpoints List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Hans de Goede , Gerd Hoffmann From: Hans de Goede Currently we reserve room for endpoint data for 16 endpoints, but given that we only use endpoint data for endpoints 1-15, and always index the array with the endpoint-number - 1, 15 is enough. Signed-off-by: Hans de Goede Signed-off-by: Gerd Hoffmann --- usb-linux.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/usb-linux.c b/usb-linux.c index 4c42fe1..4498b16 100644 --- a/usb-linux.c +++ b/usb-linux.c @@ -78,7 +78,7 @@ typedef int USBScanFunc(void *opaque, int bus_num, int addr, int devpath, #define USBPROCBUS_PATH "/proc/bus/usb" #define PRODUCT_NAME_SZ 32 -#define MAX_ENDPOINTS 16 +#define MAX_ENDPOINTS 15 #define USBDEVBUS_PATH "/dev/bus/usb" #define USBSYSBUS_PATH "/sys/bus/usb" @@ -725,7 +725,7 @@ static int usb_host_set_interface(USBHostDevice *s, int iface, int alt) struct usbdevfs_setinterface si; int i, ret; - for (i = 1; i < MAX_ENDPOINTS; i++) { + for (i = 1; i <= MAX_ENDPOINTS; i++) { if (is_isoc(s, i)) { usb_host_stop_n_free_iso(s, i); } @@ -1276,7 +1276,7 @@ static int usb_host_close(USBHostDevice *dev) qemu_set_fd_handler(dev->fd, NULL, NULL, NULL); dev->closing = 1; - for (i = 1; i < MAX_ENDPOINTS; i++) { + for (i = 1; i <= MAX_ENDPOINTS; i++) { if (is_isoc(dev, i)) { usb_host_stop_n_free_iso(dev, i); } -- 1.7.1