usb-linux: fix /proc/bus/usb/devices scan
authorGerd Hoffmann <kraxel@redhat.com>
Fri, 11 Nov 2011 16:14:15 +0000 (17:14 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 21 Nov 2011 14:32:42 +0000 (15:32 +0100)
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 <armbru@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb-linux.c

index f086d57edbc774b7ed9ff2c5cea698259a46ca55..d4426ea73099b92d5f3489668940914fb6070252 100644 (file)
@@ -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;