diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2011-11-11 17:14:15 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2011-11-21 15:32:42 +0100 |
commit | 0cd0fd0867005a0344d06c01fff8f8a66b3d2ecb (patch) | |
tree | 2b2fd7290d5ed5169247b0851dad460750e897ab /usb-linux.c | |
parent | b246721614e316ce948d058dbe45702447998b5f (diff) | |
download | qemu-0cd0fd0867005a0344d06c01fff8f8a66b3d2ecb.zip |
usb-linux: fix /proc/bus/usb/devices scan
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>
Diffstat (limited to 'usb-linux.c')
-rw-r--r-- | usb-linux.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/usb-linux.c b/usb-linux.c index f086d57edb..d4426ea730 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; |