From: Gerhard Sittig Date: Mon, 29 Jan 2018 19:36:50 +0000 (+0100) Subject: usb: re-use existing values, don't re-determine bus and device address X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=6f63b1ee67ef9a8d9511aec9bac5f9d84c21356d;p=libsigrok.git usb: re-use existing values, don't re-determine bus and device address Avoid repeated libusb bus number and device address retrieval operations, instead use variables where the information previously got stored to. --- diff --git a/src/usb.c b/src/usb.c index 96df219f..8073f869 100644 --- 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);