From patchwork Mon Nov 21 16:15:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 126865 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 03914B759E for ; Tue, 22 Nov 2011 04:01:42 +1100 (EST) Received: from localhost ([::1]:36000 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RSWo2-0000aq-SB for incoming@patchwork.ozlabs.org; Mon, 21 Nov 2011 11:33:18 -0500 Received: from eggs.gnu.org ([140.186.70.92]:57530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RSWn3-0006UL-Bg for qemu-devel@nongnu.org; Mon, 21 Nov 2011 11:32:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RSWmp-0007YY-2Q for qemu-devel@nongnu.org; Mon, 21 Nov 2011 11:32:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44828) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RSWmo-0007YJ-Oh for qemu-devel@nongnu.org; Mon, 21 Nov 2011 11:32:03 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pALGW2hP007532 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 21 Nov 2011 11:32:02 -0500 Received: from rincewind.home.kraxel.org (ovpn-116-20.ams2.redhat.com [10.36.116.20]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id pALGW0KF003592; Mon, 21 Nov 2011 11:32:00 -0500 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 25A4B405D0; Mon, 21 Nov 2011 17:15:49 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 21 Nov 2011 17:15:48 +0100 Message-Id: <1321892148-16835-8-git-send-email-kraxel@redhat.com> In-Reply-To: <1321892148-16835-1-git-send-email-kraxel@redhat.com> References: <1321892148-16835-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann , Markus Armbruster Subject: [Qemu-devel] [PATCH 7/7] usb-linux: fix /proc/bus/usb/devices scan X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Commit 0c402e5abb8c2755390eee864b43a98280fc2453 is incomplete and misses one of the two function pointer calls in usb_host_scan_dev(). Add the additional port handling logic to the other call too. Spotted by Coverity. Cc: Markus Armbruster Signed-off-by: Gerd Hoffmann Reviewed-by: Markus Armbruster --- usb-linux.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/usb-linux.c b/usb-linux.c index f086d57..d4426ea 100644 --- a/usb-linux.c +++ b/usb-linux.c @@ -1568,7 +1568,12 @@ static int usb_host_scan_dev(void *opaque, USBScanFunc *func) if (line[0] == 'T' && line[1] == ':') { if (device_count && (vendor_id || product_id)) { /* New device. Add the previously discovered device. */ - ret = func(opaque, bus_num, addr, 0, class_id, vendor_id, + if (port > 0) { + snprintf(buf, sizeof(buf), "%d", port); + } else { + snprintf(buf, sizeof(buf), "?"); + } + ret = func(opaque, bus_num, addr, buf, class_id, vendor_id, product_id, product_name, speed); if (ret) { goto the_end;