Received: from eggs.gnu.org ([140.186.70.92]:48688) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRLMK-0005Jx-DF for qemu-devel@nongnu.org; Tue, 31 May 2011 05:35:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QRLMJ-0002kW-Fk for qemu-devel@nongnu.org; Tue, 31 May 2011 05:35:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:62337) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRLMJ-0002kQ-8g for qemu-devel@nongnu.org; Tue, 31 May 2011 05:35:31 -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 p4V9ZURx007914 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 31 May 2011 05:35:30 -0400 From: Hans de Goede Date: Tue, 31 May 2011 11:35:21 +0200 Message-Id: <1306834530-12763-6-git-send-email-hdegoede@redhat.com> In-Reply-To: <1306834530-12763-1-git-send-email-hdegoede@redhat.com> References: <1306834530-12763-1-git-send-email-hdegoede@redhat.com> Subject: [Qemu-devel] [PATCH 05/14] usb-linux: Don't call usb_host_close when usb_host_open fails List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Hans de Goede --- usb-linux.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/usb-linux.c b/usb-linux.c index e6c6138..544aea3 100644 --- a/usb-linux.c +++ b/usb-linux.c @@ -363,13 +363,16 @@ static int usb_host_claim_interfaces(USBHostDevice *dev, int configuration) const char *op = NULL; int dev_descr_len, config_descr_len; int interface, nb_interfaces; - int ret, i; + int ret, i, close_on_nodev; if (configuration == 0) /* address state - ignore */ return 1; DPRINTF("husb: claiming interfaces. config %d\n", configuration); + /* Don't close on nodev when called from usb_host_open (which passes -1) */ + close_on_nodev = (configuration == -1) ? 0 : 1; + i = 0; dev_descr_len = dev->descr[0]; if (dev_descr_len > dev->descr_len) { @@ -445,7 +448,7 @@ static int usb_host_claim_interfaces(USBHostDevice *dev, int configuration) return 1; fail: - if (errno == ENODEV) { + if (errno == ENODEV && close_on_nodev) { do_disconnect(dev); } perror(op); -- 1.7.5.1