]> sigrok.org Git - libsigrok.git/commitdiff
usb: re-use existing values, don't re-determine bus and device address
authorGerhard Sittig <redacted>
Mon, 29 Jan 2018 19:36:50 +0000 (20:36 +0100)
committerGerhard Sittig <redacted>
Fri, 9 Feb 2018 20:59:18 +0000 (21:59 +0100)
Avoid repeated libusb bus number and device address retrieval operations,
instead use variables where the information previously got stored to.

src/usb.c

index 96df219fd734fa168d6347bfeeddad0d2e331f03..8073f869dbdacf3f5a9842d6ee516a23507e7773 100644 (file)
--- a/src/usb.c
+++ b/src/usb.c
@@ -384,8 +384,7 @@ SR_PRIV GSList *sr_usb_find(libusb_context *usb_ctx, const char *conn)
                sr_dbg("Found USB device (VID:PID = %04x:%04x, bus.address = "
                       "%d.%d).", des.idVendor, des.idProduct, b, a);
 
-               usb = sr_usb_dev_inst_new(libusb_get_bus_number(devlist[i]),
-                               libusb_get_device_address(devlist[i]), NULL);
+               usb = sr_usb_dev_inst_new(b, a, NULL);
                devices = g_slist_append(devices, usb);
        }
        libusb_free_device_list(devlist, 1);